b9e4b957 |
// +build windows
package daemon
import (
"strings"
|
6bb0d181 |
"github.com/docker/docker/container" |
b9e4b957 |
"github.com/docker/docker/daemon/execdriver" |
7ac4232e |
"github.com/docker/docker/daemon/execdriver/windows" |
a283a30f |
derr "github.com/docker/docker/errors" |
4352da78 |
"github.com/docker/docker/layer" |
2bb3fc1b |
networktypes "github.com/docker/engine-api/types/network" |
5bb4d0d9 |
"github.com/docker/libnetwork" |
b9e4b957 |
)
|
6bb0d181 |
func (daemon *Daemon) setupLinkedContainers(container *container.Container) ([]string, error) { |
b9e4b957 |
return nil, nil
}
|
c427131c |
// updateContainerNetworkSettings update the network settings |
2bb3fc1b |
func (daemon *Daemon) updateContainerNetworkSettings(container *container.Container, endpointsConfig map[string]*networktypes.EndpointSettings) error { |
c427131c |
return nil
}
|
6bb0d181 |
func (daemon *Daemon) initializeNetworking(container *container.Container) error { |
b9e4b957 |
return nil
}
|
2ab94e11 |
// ConnectToNetwork connects a container to the network |
2bb3fc1b |
func (daemon *Daemon) ConnectToNetwork(container *container.Container, idOrName string, endpointConfig *networktypes.EndpointSettings) error { |
2ab94e11 |
return nil
}
|
b464f1d7 |
// ForceEndpointDelete deletes an endpoing from a network forcefully
func (daemon *Daemon) ForceEndpointDelete(name string, n libnetwork.Network) error {
return nil
}
|
5bb4d0d9 |
// DisconnectFromNetwork disconnects a container from the network. |
b464f1d7 |
func (daemon *Daemon) DisconnectFromNetwork(container *container.Container, n libnetwork.Network, force bool) error { |
5bb4d0d9 |
return nil
}
|
6bb0d181 |
func (daemon *Daemon) populateCommand(c *container.Container, env []string) error { |
b9e4b957 |
en := &execdriver.Network{
Interface: nil,
}
|
6bb0d181 |
parts := strings.SplitN(string(c.HostConfig.NetworkMode), ":", 2) |
b9e4b957 |
switch parts[0] {
case "none": |
c5e6a4b3 |
case "default", "": // empty string to support existing containers |
b9e4b957 |
if !c.Config.NetworkDisabled {
en.Interface = &execdriver.NetworkInterface{ |
4393be71 |
MacAddress: c.Config.MacAddress, |
c446fd20 |
Bridge: daemon.configStore.bridgeConfig.VirtualSwitchName, |
6bb0d181 |
PortBindings: c.HostConfig.PortBindings, |
4393be71 |
// TODO Windows. Include IPAddress. There already is a
// property IPAddress on execDrive.CommonNetworkInterface,
// but there is no CLI option in docker to pass through
// an IPAddress on docker run. |
b9e4b957 |
}
}
default: |
6bb0d181 |
return derr.ErrorCodeInvalidNetworkMode.WithArgs(c.HostConfig.NetworkMode) |
b9e4b957 |
}
|
a5879bb8 |
// TODO Windows. More resource controls to be implemented later.
resources := &execdriver.Resources{ |
b1220a76 |
CommonResources: execdriver.CommonResources{ |
6bb0d181 |
CPUShares: c.HostConfig.CPUShares, |
b1220a76 |
}, |
a5879bb8 |
} |
b9e4b957 |
processConfig := execdriver.ProcessConfig{ |
5fa2e4d4 |
CommonProcessConfig: execdriver.CommonProcessConfig{
Entrypoint: c.Path,
Arguments: c.Args,
Tty: c.Config.Tty,
}, |
6bb0d181 |
ConsoleSize: c.HostConfig.ConsoleSize, |
b9e4b957 |
}
processConfig.Env = env
|
52f4d09f |
var layerPaths []string |
4352da78 |
img, err := daemon.imageStore.Get(c.ImageID) |
dfbb5520 |
if err != nil { |
f7d4b4fe |
return derr.ErrorCodeGetGraph.WithArgs(c.ImageID, err) |
dfbb5520 |
} |
4352da78 |
if img.RootFS != nil && img.RootFS.Type == "layers+base" {
max := len(img.RootFS.DiffIDs)
for i := 0; i <= max; i++ {
img.RootFS.DiffIDs = img.RootFS.DiffIDs[:i]
path, err := layer.GetLayerPath(daemon.layerStore, img.RootFS.ChainID())
if err != nil {
return derr.ErrorCodeGetLayer.WithArgs(err)
}
// Reverse order, expecting parent most first
layerPaths = append([]string{path}, layerPaths...) |
52f4d09f |
}
} |
4352da78 |
|
d04fa49a |
m, err := c.RWLayer.Metadata() |
dfbb5520 |
if err != nil { |
f7d4b4fe |
return derr.ErrorCodeGetLayerMetadata.WithArgs(err) |
dfbb5520 |
}
layerFolder := m["dir"] |
52f4d09f |
|
7ac4232e |
var hvPartition bool
// Work out the isolation (whether it is a hypervisor partition)
if c.HostConfig.Isolation.IsDefault() {
// Not specified by caller. Take daemon default
hvPartition = windows.DefaultIsolation.IsHyperV()
} else {
// Take value specified by caller
hvPartition = c.HostConfig.Isolation.IsHyperV()
}
|
6bb0d181 |
c.Command = &execdriver.Command{ |
9d14866d |
CommonCommand: execdriver.CommonCommand{
ID: c.ID, |
6bb0d181 |
Rootfs: c.BaseFS, |
9d14866d |
InitPath: "/.dockerinit",
WorkingDir: c.Config.WorkingDir,
Network: en, |
6bb0d181 |
MountLabel: c.GetMountLabel(), |
9d14866d |
Resources: resources,
ProcessConfig: processConfig, |
6bb0d181 |
ProcessLabel: c.GetProcessLabel(), |
9d14866d |
},
FirstStart: !c.HasBeenStartedBefore,
LayerFolder: layerFolder,
LayerPaths: layerPaths,
Hostname: c.Config.Hostname, |
7ac4232e |
Isolation: string(c.HostConfig.Isolation), |
9db5db1b |
ArgsEscaped: c.Config.ArgsEscaped, |
7ac4232e |
HvPartition: hvPartition, |
b9e4b957 |
}
return nil
}
|
3a497650 |
// getSize returns real size & virtual size |
6bb0d181 |
func (daemon *Daemon) getSize(container *container.Container) (int64, int64) { |
b9e4b957 |
// TODO Windows
return 0, 0
}
|
e148e763 |
// setNetworkNamespaceKey is a no-op on Windows. |
63efc120 |
func (daemon *Daemon) setNetworkNamespaceKey(containerID string, pid int) error { |
e148e763 |
return nil
}
|
abd72d40 |
// allocateNetwork is a no-op on Windows. |
6bb0d181 |
func (daemon *Daemon) allocateNetwork(container *container.Container) error { |
b9e4b957 |
return nil
}
|
6bb0d181 |
func (daemon *Daemon) updateNetwork(container *container.Container) error { |
c8291f71 |
return nil
}
|
6bb0d181 |
func (daemon *Daemon) releaseNetwork(container *container.Container) { |
78bd17e8 |
}
|
6bb0d181 |
func (daemon *Daemon) setupIpcDirs(container *container.Container) error { |
c8291f71 |
return nil
}
|
6bb0d181 |
// TODO Windows: Fix Post-TP4. This is a hack to allow docker cp to work
// against containers which have volumes. You will still be able to cp
// to somewhere on the container drive, but not to any mounted volumes
// inside the container. Without this fix, docker cp is broken to any
// container which has a volume, regardless of where the file is inside the
// container.
func (daemon *Daemon) mountVolumes(container *container.Container) error { |
c8291f71 |
return nil
} |
7d8b5fc3 |
|
6bb0d181 |
func detachMounted(path string) error { |
b3e527df |
return nil
}
|
6bb0d181 |
func killProcessDirectly(container *container.Container) error { |
3a852d84 |
return nil
} |