mirror of https://github.com/docker/cli.git
Merge pull request #32407 from dnephin/fix-rw-mode-compose-files
Support rw as a volume option in compose file
This commit is contained in:
commit
12702bdc81
|
@ -70,6 +70,8 @@ func populateFieldFromBuffer(char rune, buffer []rune, volume *types.ServiceVolu
|
||||||
switch option {
|
switch option {
|
||||||
case "ro":
|
case "ro":
|
||||||
volume.ReadOnly = true
|
volume.ReadOnly = true
|
||||||
|
case "rw":
|
||||||
|
volume.ReadOnly = false
|
||||||
case "nocopy":
|
case "nocopy":
|
||||||
volume.Volume = &types.ServiceVolumeVolume{NoCopy: true}
|
volume.Volume = &types.ServiceVolumeVolume{NoCopy: true}
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -132,3 +132,17 @@ func TestParseVolumeWithReadOnly(t *testing.T) {
|
||||||
assert.DeepEqual(t, volume, expected)
|
assert.DeepEqual(t, volume, expected)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestParseVolumeWithRW(t *testing.T) {
|
||||||
|
for _, path := range []string{"./foo", "/home/user"} {
|
||||||
|
volume, err := parseVolume(path + ":/target:rw")
|
||||||
|
expected := types.ServiceVolumeConfig{
|
||||||
|
Type: "bind",
|
||||||
|
Source: path,
|
||||||
|
Target: "/target",
|
||||||
|
ReadOnly: false,
|
||||||
|
}
|
||||||
|
assert.NilError(t, err)
|
||||||
|
assert.DeepEqual(t, volume, expected)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue