mirror of https://github.com/docker/compose.git
parent
9e1dfcfb37
commit
6e932794f7
|
@ -222,7 +222,10 @@ class Service(object):
|
||||||
for volume in options['volumes']:
|
for volume in options['volumes']:
|
||||||
if ':' in volume:
|
if ':' in volume:
|
||||||
external_dir, internal_dir = volume.split(':')
|
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)
|
privileged = options.get('privileged', False)
|
||||||
|
|
||||||
|
|
|
@ -114,6 +114,12 @@ class ServiceTest(DockerClientTestCase):
|
||||||
service.start_container(container)
|
service.start_container(container)
|
||||||
self.assertIn('/var/db', container.inspect()['Volumes'])
|
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):
|
def test_recreate_containers(self):
|
||||||
service = self.create_service(
|
service = self.create_service(
|
||||||
'db',
|
'db',
|
||||||
|
|
Loading…
Reference in New Issue