6 "github.com/docker/docker/api/types/container"
7 "github.com/docker/docker/pkg/sysinfo"
10 // DefaultDaemonNetworkMode returns the default network stack the daemon should
12 func DefaultDaemonNetworkMode() container.NetworkMode {
13 return container.NetworkMode("nat")
16 // IsPreDefinedNetwork indicates if a network is predefined by the daemon
17 func IsPreDefinedNetwork(network string) bool {
18 return !container.NetworkMode(network).IsUserDefined()
21 // validateNetMode ensures that the various combinations of requested
22 // network settings are valid.
23 func validateNetMode(c *container.Config, hc *container.HostConfig) error {
28 err := validateNetContainerMode(c, hc)
33 if hc.NetworkMode.IsContainer() && hc.Isolation.IsHyperV() {
34 return fmt.Errorf("Using the network stack of another container is not supported while using Hyper-V Containers")
40 // validateIsolation performs platform specific validation of the
41 // isolation in the hostconfig structure. Windows supports 'default' (or
42 // blank), 'process', or 'hyperv'.
43 func validateIsolation(hc *container.HostConfig) error {
44 // We may not be passed a host config, such as in the case of docker commit
48 if !hc.Isolation.IsValid() {
49 return fmt.Errorf("Invalid isolation: %q. Windows supports 'default', 'process', or 'hyperv'", hc.Isolation)
54 // validateQoS performs platform specific validation of the Qos settings
55 func validateQoS(hc *container.HostConfig) error {
59 // validateResources performs platform specific validation of the resource settings
60 func validateResources(hc *container.HostConfig, si *sysinfo.SysInfo) error {
61 // We may not be passed a host config, such as in the case of docker commit
65 if hc.Resources.CPURealtimePeriod != 0 {
66 return fmt.Errorf("Windows does not support CPU real-time period")
68 if hc.Resources.CPURealtimeRuntime != 0 {
69 return fmt.Errorf("Windows does not support CPU real-time runtime")
74 // validatePrivileged performs platform specific validation of the Privileged setting
75 func validatePrivileged(hc *container.HostConfig) error {
76 // We may not be passed a host config, such as in the case of docker commit
81 return fmt.Errorf("Windows does not support privileged mode")
86 // validateReadonlyRootfs performs platform specific validation of the ReadonlyRootfs setting
87 func validateReadonlyRootfs(hc *container.HostConfig) error {
88 // We may not be passed a host config, such as in the case of docker commit
92 if hc.ReadonlyRootfs {
93 return fmt.Errorf("Windows does not support root filesystem in read-only mode")