Skip to content

Commit b76ac6e

Browse files
committed
Added support to option mac-address
Signed-off-by: Sébastien Gruchet <gruchet@gmail.com> Updated doc Signed-off-by: Sébastien Gruchet <gruchet@gmail.com> Fixed LINT errors Signed-off-by: Sébastien Gruchet <gruchet@gmail.com> Changed mac-address entry order in config keys Signed-off-by: Sébastien Gruchet <gruchet@gmail.com> Changed attributes order in docs/yml.md Signed-off-by: Sébastien Gruchet <gruchet@gmail.com>
1 parent 417e6ce commit b76ac6e

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

compose/config.py

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
'image',
2424
'labels',
2525
'links',
26+
'mac_address',
2627
'mem_limit',
2728
'net',
2829
'log_driver',

docs/yml.md

+4-1
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,7 @@ security_opt:
362362
- label:role:ROLE
363363
```
364364

365-
### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, privileged, restart, stdin\_open, tty, cpu\_shares, cpuset, read\_only
365+
### working\_dir, entrypoint, user, hostname, domainname, mac\_address, mem\_limit, privileged, restart, stdin\_open, tty, cpu\_shares, cpuset, read\_only
366366

367367
Each of these is a single value, analogous to its
368368
[docker run](https://docs.docker.com/reference/run/) counterpart.
@@ -378,6 +378,8 @@ user: postgresql
378378
hostname: foo
379379
domainname: foo.com
380380
381+
mac_address: 02:42:ac:11:65:43
382+
381383
mem_limit: 1000000000
382384
privileged: true
383385
@@ -386,6 +388,7 @@ restart: always
386388
stdin_open: true
387389
tty: true
388390
read_only: true
391+
389392
```
390393

391394
## Compose documentation

tests/integration/service_test.py

+6
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,12 @@ def test_create_container_with_security_opt(self):
198198
service.start_container(container)
199199
self.assertEqual(set(container.get('HostConfig.SecurityOpt')), set(security_opt))
200200

201+
def test_create_container_with_mac_address(self):
202+
service = self.create_service('db', mac_address='02:42:ac:11:65:43')
203+
container = service.create_container()
204+
service.start_container(container)
205+
self.assertEqual(container.inspect()['Config']['MacAddress'], '02:42:ac:11:65:43')
206+
201207
def test_create_container_with_specified_volume(self):
202208
host_path = '/tmp/host-path'
203209
container_path = '/container-path'

0 commit comments

Comments
 (0)