diff --git a/daemon/volumes.go b/daemon/volumes.go index 79a0e42589..aae84b92b2 100644 --- a/daemon/volumes.go +++ b/daemon/volumes.go @@ -172,7 +172,7 @@ func (daemon *Daemon) registerMountPoints(container *Container, hostConfig *runc cp := &mountPoint{ Name: m.Name, Source: m.Source, - RW: m.RW && !roModes[mode], + RW: m.RW && volume.ReadWrite(mode), Driver: m.Driver, Destination: m.Destination, } diff --git a/volume/volume.go b/volume/volume.go index e97381d88e..2d5ee35aeb 100644 --- a/volume/volume.go +++ b/volume/volume.go @@ -50,3 +50,8 @@ var roModes = map[string]bool{ func ValidateMountMode(mode string) (bool, bool) { return roModes[mode] || rwModes[mode], rwModes[mode] } + +// ReadOnly tells you if a mode string is a valid read-only mode or not. +func ReadWrite(mode string) bool { + return rwModes[mode] +}