2018-04-17 16:50:28 -04:00
|
|
|
package mounts // import "github.com/docker/docker/volume/mounts"
|
2016-03-14 23:31:42 -04:00
|
|
|
|
|
|
|
import "strings"
|
|
|
|
|
|
|
|
// {<copy mode>=isEnabled}
|
|
|
|
var copyModes = map[string]bool{
|
|
|
|
"nocopy": false,
|
|
|
|
}
|
|
|
|
|
|
|
|
func copyModeExists(mode string) bool {
|
|
|
|
_, exists := copyModes[mode]
|
|
|
|
return exists
|
|
|
|
}
|
|
|
|
|
|
|
|
// GetCopyMode gets the copy mode from the mode string for mounts
|
2017-08-01 13:32:44 -04:00
|
|
|
func getCopyMode(mode string, def bool) (bool, bool) {
|
2016-03-14 23:31:42 -04:00
|
|
|
for _, o := range strings.Split(mode, ",") {
|
|
|
|
if isEnabled, exists := copyModes[o]; exists {
|
|
|
|
return isEnabled, true
|
|
|
|
}
|
|
|
|
}
|
2017-08-01 13:32:44 -04:00
|
|
|
return def, false
|
2016-03-14 23:31:42 -04:00
|
|
|
}
|