Add support for volume consistency in compose format.

Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
Daniel Nephin 2017-04-06 11:37:55 -04:00
parent 12702bdc81
commit 545ec64de7
6 changed files with 19 additions and 11 deletions

View File

@ -32,6 +32,7 @@ func convertVolumeToMount(
Source: volume.Source,
Target: volume.Target,
ReadOnly: volume.ReadOnly,
Consistency: mount.Consistency(volume.Consistency),
}
// Anonymous volumes

View File

@ -220,6 +220,10 @@ services:
- ~/configs:/etc/configs/:ro
# Named volume
- datavolume:/var/lib/mysql
- type: bind
source: ./opt
target: /opt
consistency: cached
working_dir: /code

View File

@ -910,6 +910,7 @@ func TestFullExample(t *testing.T) {
{Source: workingDir + "/static", Target: "/var/www/html", Type: "bind"},
{Source: homeDir + "/configs", Target: "/etc/configs/", Type: "bind", ReadOnly: true},
{Source: "datavolume", Target: "/var/lib/mysql", Type: "volume"},
{Source: workingDir + "/opt", Target: "/opt", Consistency: "cached", Type: "bind"},
},
WorkingDir: "/code",
}

File diff suppressed because one or more lines are too long

View File

@ -249,6 +249,7 @@
"source": {"type": "string"},
"target": {"type": "string"},
"read_only": {"type": "boolean"},
"consistency": {"type": "string"},
"bind": {
"type": "object",
"properties": {

View File

@ -233,6 +233,7 @@ type ServiceVolumeConfig struct {
Source string
Target string
ReadOnly bool `mapstructure:"read_only"`
Consistency string
Bind *ServiceVolumeBind
Volume *ServiceVolumeVolume
}