From 6e932794f71b99ac6bd85274190d285a156fcdcc Mon Sep 17 00:00:00 2001 From: Aanand Prasad Date: Fri, 25 Apr 2014 12:28:00 +0100 Subject: [PATCH] Fix regression when mounting volumes Caused by https://github.com/dotcloud/docker-py/commit/77fec67c608d0839a795f6eb807c9df2fd5bfd45 --- fig/service.py | 5 ++++- tests/service_test.py | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/fig/service.py b/fig/service.py index 54c35d0c2..2c7cc1c89 100644 --- a/fig/service.py +++ b/fig/service.py @@ -222,7 +222,10 @@ class Service(object): for volume in options['volumes']: if ':' in volume: external_dir, internal_dir = volume.split(':') - volume_bindings[os.path.abspath(external_dir)] = internal_dir + volume_bindings[os.path.abspath(external_dir)] = { + 'bind': internal_dir, + 'ro': False, + } privileged = options.get('privileged', False) diff --git a/tests/service_test.py b/tests/service_test.py index f1b1f9de5..78947e1f6 100644 --- a/tests/service_test.py +++ b/tests/service_test.py @@ -114,6 +114,12 @@ class ServiceTest(DockerClientTestCase): service.start_container(container) self.assertIn('/var/db', container.inspect()['Volumes']) + def test_create_container_with_specified_volume(self): + service = self.create_service('db', volumes=['/tmp:/host-tmp']) + container = service.create_container() + service.start_container(container) + self.assertIn('/host-tmp', container.inspect()['Volumes']) + def test_recreate_containers(self): service = self.create_service( 'db',