Support 'nocopy' mode for expanded volume syntax

Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
Joffrey F 2017-03-22 17:04:26 -07:00
parent 0d1608c17c
commit eab1ee0eaf
3 changed files with 12 additions and 3 deletions

View File

@ -1033,8 +1033,11 @@ def resolve_volume_path(working_dir, volume):
if isinstance(volume, dict): if isinstance(volume, dict):
host_path = volume.get('source') host_path = volume.get('source')
container_path = volume.get('target') container_path = volume.get('target')
if host_path and volume.get('read_only'): if host_path:
if volume.get('read_only'):
container_path += ':ro' container_path += ':ro'
if volume.get('volume', {}).get('nocopy'):
container_path += ':nocopy'
else: else:
container_path, host_path = split_path_mapping(volume) container_path, host_path = split_path_mapping(volume)

View File

@ -374,7 +374,8 @@ class CLITestCase(DockerClientTestCase):
'volumes': [ 'volumes': [
'/host/path:/container/path:ro', '/host/path:/container/path:ro',
'foobar:/container/volumepath:rw', 'foobar:/container/volumepath:rw',
'/anonymous' '/anonymous',
'foobar:/container/volumepath2:nocopy'
], ],
'stop_grace_period': '20s', 'stop_grace_period': '20s',

View File

@ -44,6 +44,11 @@ services:
target: /container/volumepath target: /container/volumepath
- type: volume - type: volume
target: /anonymous target: /anonymous
- type: volume
source: foobar
target: /container/volumepath2
volume:
nocopy: true
stop_grace_period: 20s stop_grace_period: 20s
volumes: volumes: