container/container_windows.go
6bb0d181
 // +build windows
 
 package container
 
 import (
ff3ea4c9
 	"fmt"
67912303
 	"os"
 	"path/filepath"
 
6bb0d181
 	"github.com/docker/docker/volume"
5849a553
 	containertypes "github.com/docker/engine-api/types/container"
6bb0d181
 )
 
 // Container holds fields specific to the Windows implementation. See
 // CommonContainer for standard fields common to all containers.
 type Container struct {
 	CommonContainer
 
e8026d8a
 	HostnamePath   string
 	HostsPath      string
 	ResolvConfPath string
6bb0d181
 	// Fields below here are platform specific.
 }
 
94d70d83
 // ExitStatus provides exit reasons for a container.
 type ExitStatus struct {
 	// The exit code with which the container exited.
 	ExitCode int
 }
 
6bb0d181
 // CreateDaemonEnvironment creates a new environment variable slice for this container.
 func (container *Container) CreateDaemonEnvironment(linkedEnv []string) []string {
 	// On Windows, nothing to link. Just return the container environment.
 	return container.Config.Env
 }
 
 // UnmountIpcMounts unmount Ipc related mounts.
 // This is a NOOP on windows.
 func (container *Container) UnmountIpcMounts(unmount func(pth string) error) {
 }
 
 // IpcMounts returns the list of Ipc related mounts.
94d70d83
 func (container *Container) IpcMounts() []Mount {
6bb0d181
 	return nil
 }
 
927b334e
 // UnmountVolumes explicitly unmounts volumes from the container.
9d12d093
 func (container *Container) UnmountVolumes(forceSyscall bool, volumeEventLog func(name, action string, attributes map[string]string)) error {
6bb0d181
 	return nil
 }
 
 // TmpfsMounts returns the list of tmpfs mounts
94d70d83
 func (container *Container) TmpfsMounts() []Mount {
6bb0d181
 	return nil
 }
 
ff3ea4c9
 // UpdateContainer updates configuration of a container
5849a553
 func (container *Container) UpdateContainer(hostConfig *containertypes.HostConfig) error {
ff3ea4c9
 	container.Lock()
 	defer container.Unlock()
 	resources := hostConfig.Resources
 	if resources.BlkioWeight != 0 || resources.CPUShares != 0 ||
 		resources.CPUPeriod != 0 || resources.CPUQuota != 0 ||
 		resources.CpusetCpus != "" || resources.CpusetMems != "" ||
 		resources.Memory != 0 || resources.MemorySwap != 0 ||
 		resources.MemoryReservation != 0 || resources.KernelMemory != 0 {
 		return fmt.Errorf("Resource updating isn't supported on Windows")
 	}
 	// update HostConfig of container
 	if hostConfig.RestartPolicy.Name != "" {
 		container.HostConfig.RestartPolicy = hostConfig.RestartPolicy
 	}
8799c4fc
 	return nil
 }
 
6bb0d181
 // appendNetworkMounts appends any network mounts to the array of mount points passed in.
 // Windows does not support network mounts (not to be confused with SMB network mounts), so
 // this is a no-op.
 func appendNetworkMounts(container *Container, volumeMounts []volume.MountPoint) ([]volume.MountPoint, error) {
 	return volumeMounts, nil
 }
67912303
 
 // cleanResourcePath cleans a resource path by removing C:\ syntax, and prepares
 // to combine with a volume path
 func cleanResourcePath(path string) string {
 	if len(path) >= 2 {
 		c := path[0]
 		if path[1] == ':' && ('a' <= c && c <= 'z' || 'A' <= c && c <= 'Z') {
 			path = path[2:]
 		}
 	}
 	return filepath.Join(string(os.PathSeparator), path)
 }
5849a553
 
e8026d8a
 // BuildHostnameFile writes the container's hostname file.
 func (container *Container) BuildHostnameFile() error {
 	return nil
 }
 
5849a553
 // canMountFS determines if the file system for the container
 // can be mounted locally. In the case of Windows, this is not possible
 // for Hyper-V containers during WORKDIR execution for example.
 func (container *Container) canMountFS() bool {
 	return !containertypes.Isolation.IsHyperV(container.HostConfig.Isolation)
 }