From b76ac6e633c5e8881162a34c6afdc2f50874aa02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Gruchet?= Date: Fri, 20 Mar 2015 20:14:30 +0100 Subject: [PATCH] Added support to option mac-address MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Sébastien Gruchet Updated doc Signed-off-by: Sébastien Gruchet Fixed LINT errors Signed-off-by: Sébastien Gruchet Changed mac-address entry order in config keys Signed-off-by: Sébastien Gruchet Changed attributes order in docs/yml.md Signed-off-by: Sébastien Gruchet --- compose/config.py | 1 + docs/yml.md | 5 ++++- tests/integration/service_test.py | 6 ++++++ 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/compose/config.py b/compose/config.py index efc50075e3..cbdeca2d08 100644 --- a/compose/config.py +++ b/compose/config.py @@ -23,6 +23,7 @@ 'image', 'labels', 'links', + 'mac_address', 'mem_limit', 'net', 'log_driver', diff --git a/docs/yml.md b/docs/yml.md index df791bc98f..ed0e6ad870 100644 --- a/docs/yml.md +++ b/docs/yml.md @@ -362,7 +362,7 @@ security_opt: - label:role:ROLE ``` -### working\_dir, entrypoint, user, hostname, domainname, mem\_limit, privileged, restart, stdin\_open, tty, cpu\_shares, cpuset, read\_only +### working\_dir, entrypoint, user, hostname, domainname, mac\_address, mem\_limit, privileged, restart, stdin\_open, tty, cpu\_shares, cpuset, read\_only Each of these is a single value, analogous to its [docker run](https://docs.docker.com/reference/run/) counterpart. @@ -378,6 +378,8 @@ user: postgresql hostname: foo domainname: foo.com +mac_address: 02:42:ac:11:65:43 + mem_limit: 1000000000 privileged: true @@ -386,6 +388,7 @@ restart: always stdin_open: true tty: true read_only: true + ``` ## Compose documentation diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py index 7e88557f93..4067f419d3 100644 --- a/tests/integration/service_test.py +++ b/tests/integration/service_test.py @@ -198,6 +198,12 @@ def test_create_container_with_security_opt(self): service.start_container(container) self.assertEqual(set(container.get('HostConfig.SecurityOpt')), set(security_opt)) + def test_create_container_with_mac_address(self): + service = self.create_service('db', mac_address='02:42:ac:11:65:43') + container = service.create_container() + service.start_container(container) + self.assertEqual(container.inspect()['Config']['MacAddress'], '02:42:ac:11:65:43') + def test_create_container_with_specified_volume(self): host_path = '/tmp/host-path' container_path = '/container-path'