github.com/pwn-term/docker@v0.0.0-20210616085119-6e977cce2565/moby/volume/mounts/volume_copy.go (about)

     1  package mounts // import "github.com/docker/docker/volume/mounts"
     2  
     3  import "strings"
     4  
     5  // {<copy mode>=isEnabled}
     6  var copyModes = map[string]bool{
     7  	"nocopy": false,
     8  }
     9  
    10  func copyModeExists(mode string) bool {
    11  	_, exists := copyModes[mode]
    12  	return exists
    13  }
    14  
    15  // GetCopyMode gets the copy mode from the mode string for mounts
    16  func getCopyMode(mode string, def bool) (bool, bool) {
    17  	for _, o := range strings.Split(mode, ",") {
    18  		if isEnabled, exists := copyModes[o]; exists {
    19  			return isEnabled, true
    20  		}
    21  	}
    22  	return def, false
    23  }