github.com/ncdc/docker@v0.10.1-0.20160129113957-6c6729ef5b74/runconfig/hostconfig_windows.go (about) 1 package runconfig 2 3 import ( 4 "fmt" 5 "strings" 6 7 "github.com/docker/engine-api/types/container" 8 ) 9 10 // DefaultDaemonNetworkMode returns the default network stack the daemon should 11 // use. 12 func DefaultDaemonNetworkMode() container.NetworkMode { 13 return container.NetworkMode("default") 14 } 15 16 // IsPreDefinedNetwork indicates if a network is predefined by the daemon 17 func IsPreDefinedNetwork(network string) bool { 18 return false 19 } 20 21 // ValidateNetMode ensures that the various combinations of requested 22 // network settings are valid. 23 func ValidateNetMode(c *container.Config, hc *container.HostConfig) error { 24 // We may not be passed a host config, such as in the case of docker commit 25 if hc == nil { 26 return nil 27 } 28 parts := strings.Split(string(hc.NetworkMode), ":") 29 switch mode := parts[0]; mode { 30 case "default", "none": 31 default: 32 return fmt.Errorf("invalid --net: %s", hc.NetworkMode) 33 } 34 return nil 35 } 36 37 // ValidateIsolationLevel performs platform specific validation of the 38 // isolation level in the hostconfig structure. Windows supports 'default' (or 39 // blank), 'process', or 'hyperv'. 40 func ValidateIsolationLevel(hc *container.HostConfig) error { 41 // We may not be passed a host config, such as in the case of docker commit 42 if hc == nil { 43 return nil 44 } 45 if !hc.Isolation.IsValid() { 46 return fmt.Errorf("invalid --isolation: %q. Windows supports 'default', 'process', or 'hyperv'", hc.Isolation) 47 } 48 return nil 49 }