diff --git a/cli/compose/loader/volume.go b/cli/compose/loader/volume.go index 3f33492ea7..4dce1b2ef5 100644 --- a/cli/compose/loader/volume.go +++ b/cli/compose/loader/volume.go @@ -70,6 +70,8 @@ func populateFieldFromBuffer(char rune, buffer []rune, volume *types.ServiceVolu switch option { case "ro": volume.ReadOnly = true + case "rw": + volume.ReadOnly = false case "nocopy": volume.Volume = &types.ServiceVolumeVolume{NoCopy: true} default: diff --git a/cli/compose/loader/volume_test.go b/cli/compose/loader/volume_test.go index 0735d5a54a..19d19f2306 100644 --- a/cli/compose/loader/volume_test.go +++ b/cli/compose/loader/volume_test.go @@ -132,3 +132,17 @@ func TestParseVolumeWithReadOnly(t *testing.T) { 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) + } +}