-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdaemon_windows.go
138 lines (115 loc) · 3.64 KB
/
daemon_windows.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
package daemon
import (
"fmt"
"os"
"syscall"
"github.com/docker/docker/daemon/graphdriver"
// register the windows graph driver
_ "github.com/docker/docker/daemon/graphdriver/windows"
"github.com/docker/docker/pkg/parsers"
"github.com/docker/docker/runconfig"
"github.com/docker/libnetwork"
)
const (
defaultVirtualSwitch = "Virtual Switch"
platformSupported = true
)
func parseSecurityOpt(container *Container, config *runconfig.HostConfig) error {
return nil
}
func setupInitLayer(initLayer string) error {
return nil
}
func checkKernel() error {
return nil
}
// adaptContainerSettings is called during container creation to modify any
// settings necessary in the HostConfig structure.
func (daemon *Daemon) adaptContainerSettings(hostConfig *runconfig.HostConfig, adjustCPUShares bool) {
}
// verifyPlatformContainerSettings performs platform-specific validation of the
// hostconfig and config structures.
func verifyPlatformContainerSettings(daemon *Daemon, hostConfig *runconfig.HostConfig, config *runconfig.Config) ([]string, error) {
return nil, nil
}
// checkConfigOptions checks for mutually incompatible config options
func checkConfigOptions(config *Config) error {
return nil
}
// checkSystem validates platform-specific requirements
func checkSystem() error {
var dwVersion uint32
// TODO Windows. May need at some point to ensure have elevation and
// possibly LocalSystem.
// Validate the OS version. Note that docker.exe must be manifested for this
// call to return the correct version.
dwVersion, err := syscall.GetVersion()
if err != nil {
return fmt.Errorf("Failed to call GetVersion()")
}
if int(dwVersion&0xFF) < 10 {
return fmt.Errorf("This version of Windows does not support the docker daemon")
}
return nil
}
// configureKernelSecuritySupport configures and validate security support for the kernel
func configureKernelSecuritySupport(config *Config, driverName string) error {
return nil
}
func migrateIfDownlevel(driver graphdriver.Driver, root string) error {
return nil
}
func configureSysInit(config *Config) (string, error) {
// TODO Windows.
return os.Getenv("TEMP"), nil
}
func isBridgeNetworkDisabled(config *Config) bool {
return false
}
func initNetworkController(config *Config) (libnetwork.NetworkController, error) {
// Set the name of the virtual switch if not specified by -b on daemon start
if config.Bridge.VirtualSwitchName == "" {
config.Bridge.VirtualSwitchName = defaultVirtualSwitch
}
return nil, nil
}
// registerLinks sets up links between containers and writes the
// configuration out for persistence.
func (daemon *Daemon) registerLinks(container *Container, hostConfig *runconfig.HostConfig) error {
// TODO Windows. Factored out for network modes. There may be more
// refactoring required here.
if hostConfig == nil || hostConfig.Links == nil {
return nil
}
for _, l := range hostConfig.Links {
name, alias, err := parsers.ParseLink(l)
if err != nil {
return err
}
child, err := daemon.Get(name)
if err != nil {
//An error from daemon.Get() means this name could not be found
return fmt.Errorf("Could not get container for %s", name)
}
if err := daemon.registerLink(container, child, alias); err != nil {
return err
}
}
// After we load all the links into the daemon
// set them to nil on the hostconfig
hostConfig.Links = nil
if err := container.writeHostConfig(); err != nil {
return err
}
return nil
}
func (daemon *Daemon) newBaseContainer(id string) Container {
return Container{
CommonContainer: CommonContainer{
ID: id,
State: NewState(),
execCommands: newExecStore(),
root: daemon.containerRoot(id),
},
}
}