From d83bdd5164125da4a1dae0161d8c6dae0b63529f Mon Sep 17 00:00:00 2001 From: Alexey Lebedeff Date: Sun, 6 Jul 2014 20:09:30 +0400 Subject: [PATCH] Change working dir through fig.yml Closes #144 Signed-off-by: Alexey Lebedeff --- fig/service.py | 3 ++- tests/integration/service_test.py | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/fig/service.py b/fig/service.py index f21302f63..c0cc297c4 100644 --- a/fig/service.py +++ b/fig/service.py @@ -11,7 +11,7 @@ from .progress_stream import stream_output, StreamOutputError log = logging.getLogger(__name__) -DOCKER_CONFIG_KEYS = ['image', 'command', 'hostname', 'user', 'detach', 'stdin_open', 'tty', 'mem_limit', 'ports', 'environment', 'dns', 'volumes', 'entrypoint', 'privileged', 'volumes_from', 'net'] +DOCKER_CONFIG_KEYS = ['image', 'command', 'hostname', 'user', 'detach', 'stdin_open', 'tty', 'mem_limit', 'ports', 'environment', 'dns', 'volumes', 'entrypoint', 'privileged', 'volumes_from', 'net', 'working_dir'] DOCKER_CONFIG_HINTS = { 'link' : 'links', 'port' : 'ports', @@ -19,6 +19,7 @@ DOCKER_CONFIG_HINTS = { 'priviliged': 'privileged', 'privilige' : 'privileged', 'volume' : 'volumes', + 'workdir' : 'working_dir', } VALID_NAME_CHARS = '[a-zA-Z0-9]' diff --git a/tests/integration/service_test.py b/tests/integration/service_test.py index a8fb102a1..315e14ce3 100644 --- a/tests/integration/service_test.py +++ b/tests/integration/service_test.py @@ -301,3 +301,8 @@ class ServiceTest(DockerClientTestCase): service = self.create_service('web', net='host') container = service.start_container().inspect() self.assertEqual(container['HostConfig']['NetworkMode'], 'host') + + def test_working_dir_param(self): + service = self.create_service('container', working_dir='/working/dir/sample') + container = service.create_container().inspect() + self.assertEqual(container['Config']['WorkingDir'], '/working/dir/sample')