github.com/tompao/docker@v1.9.1/runconfig/parse_windows.go (about) 1 package runconfig 2 3 import ( 4 "fmt" 5 "strings" 6 ) 7 8 // ValidateNetMode ensures that the various combinations of requested 9 // network settings are valid. 10 func ValidateNetMode(c *Config, hc *HostConfig) error { 11 // We may not be passed a host config, such as in the case of docker commit 12 if hc == nil { 13 return nil 14 } 15 parts := strings.Split(string(hc.NetworkMode), ":") 16 switch mode := parts[0]; mode { 17 case "default", "none": 18 default: 19 return fmt.Errorf("invalid --net: %s", hc.NetworkMode) 20 } 21 return nil 22 }