From 747186f9008609d7ff2ddfede71ab0916c4a5718 Mon Sep 17 00:00:00 2001 From: Joffrey F Date: Wed, 22 Mar 2017 17:04:26 -0700 Subject: [PATCH] Support 'nocopy' mode for expanded volume syntax Signed-off-by: Joffrey F --- compose/config/config.py | 7 +++++-- tests/acceptance/cli_test.py | 3 ++- tests/fixtures/v3-full/docker-compose.yml | 5 +++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/compose/config/config.py b/compose/config/config.py index 8cbaae272..72687d756 100644 --- a/compose/config/config.py +++ b/compose/config/config.py @@ -1033,8 +1033,11 @@ def resolve_volume_path(working_dir, volume): if isinstance(volume, dict): host_path = volume.get('source') container_path = volume.get('target') - if host_path and volume.get('read_only'): - container_path += ':ro' + if host_path: + if volume.get('read_only'): + container_path += ':ro' + if volume.get('volume', {}).get('nocopy'): + container_path += ':nocopy' else: container_path, host_path = split_path_mapping(volume) diff --git a/tests/acceptance/cli_test.py b/tests/acceptance/cli_test.py index 14e6f7336..bceb102a2 100644 --- a/tests/acceptance/cli_test.py +++ b/tests/acceptance/cli_test.py @@ -374,7 +374,8 @@ class CLITestCase(DockerClientTestCase): 'volumes': [ '/host/path:/container/path:ro', 'foobar:/container/volumepath:rw', - '/anonymous' + '/anonymous', + 'foobar:/container/volumepath2:nocopy' ], 'stop_grace_period': '20s', diff --git a/tests/fixtures/v3-full/docker-compose.yml b/tests/fixtures/v3-full/docker-compose.yml index 27f3c6e04..2bc0e248d 100644 --- a/tests/fixtures/v3-full/docker-compose.yml +++ b/tests/fixtures/v3-full/docker-compose.yml @@ -44,6 +44,11 @@ services: target: /container/volumepath - type: volume target: /anonymous + - type: volume + source: foobar + target: /container/volumepath2 + volume: + nocopy: true stop_grace_period: 20s volumes: