From b325cd70f66fb73f1869ecbe03899bc8b3bad94a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20=27birdy=27=20Danjou?= Date: Thu, 12 Feb 2015 14:01:11 +0100 Subject: [PATCH] Adding extra_hosts parameter MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Clément Danjou --- docs/yml.md | 12 +++++++++++- tests/integration/service_test.py | 9 +++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/docs/yml.md b/docs/yml.md index 41247c70348..a60f90b6dfb 100644 --- a/docs/yml.md +++ b/docs/yml.md @@ -344,7 +344,7 @@ dns_search: ### devices -List of device mappings. Uses the same format as the `--device` docker +List of device mappings. Uses the same format as the `--device` docker client create option. ``` @@ -388,3 +388,13 @@ read_only: true - [Command line reference](cli.md) - [Compose environment variables](env.md) - [Compose command line completion](completion.md) + + +### extra_hosts + +Add custom entry in /etc/hosts file. + +``` +extra_hosts: + mymemcacheserver: 192.168.0.10 +``` diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py index 08e92a57ff6..1a0fbe945ba 100644 --- a/tests/integration/service_test.py +++ b/tests/integration/service_test.py @@ -230,6 +230,15 @@ def test_create_container_with_volumes_from(self): self.assertIn(volume_container_2.id, host_container.get('HostConfig.VolumesFrom')) + def test_create_container_with_extra_hosts(self): + extra_hosts = {'myserver': '192.168.2.90', + 'myserver2': '10.55.32.12'} + service = self.create_service('database', extra_hosts=extra_hosts) + container = service.create_container() + service.start_container(container) + self.assertEqual(container.get('HostConfig.ExtraHosts'), + ['myserver:192.168.2.90', 'myserver2:10.55.32.12']) + def test_recreate_containers(self): service = self.create_service( 'db',