github.com/dpiddy/docker@v1.12.2-rc1/volume/volume_copy.go (about) 1 package volume 2 3 import "strings" 4 5 const ( 6 // DefaultCopyMode is the copy mode used by default for normal/named volumes 7 DefaultCopyMode = true 8 ) 9 10 // {<copy mode>=isEnabled} 11 var copyModes = map[string]bool{ 12 "nocopy": false, 13 } 14 15 func copyModeExists(mode string) bool { 16 _, exists := copyModes[mode] 17 return exists 18 } 19 20 // GetCopyMode gets the copy mode from the mode string for mounts 21 func getCopyMode(mode string) (bool, bool) { 22 for _, o := range strings.Split(mode, ",") { 23 if isEnabled, exists := copyModes[o]; exists { 24 return isEnabled, true 25 } 26 } 27 return DefaultCopyMode, false 28 }