Signed-off-by: John Howard <jhoward@microsoft.com>
| ... | ... |
@@ -61,7 +61,6 @@ type CommonConfig struct {
|
| 61 | 61 |
DNSOptions []string `json:"dns-opts,omitempty"` |
| 62 | 62 |
DNSSearch []string `json:"dns-search,omitempty"` |
| 63 | 63 |
ExecOptions []string `json:"exec-opts,omitempty"` |
| 64 |
- ExecRoot string `json:"exec-root,omitempty"` |
|
| 65 | 64 |
GraphDriver string `json:"storage-driver,omitempty"` |
| 66 | 65 |
GraphOptions []string `json:"storage-opts,omitempty"` |
| 67 | 66 |
Labels []string `json:"labels,omitempty"` |
| ... | ... |
@@ -115,7 +114,6 @@ func (config *Config) InstallCommonFlags(cmd *flag.FlagSet, usageFn func(string) |
| 115 | 115 |
cmd.Var(opts.NewNamedListOptsRef("exec-opts", &config.ExecOptions, nil), []string{"-exec-opt"}, usageFn("Set runtime execution options"))
|
| 116 | 116 |
cmd.StringVar(&config.Pidfile, []string{"p", "-pidfile"}, defaultPidFile, usageFn("Path to use for daemon PID file"))
|
| 117 | 117 |
cmd.StringVar(&config.Root, []string{"g", "-graph"}, defaultGraph, usageFn("Root of the Docker runtime"))
|
| 118 |
- cmd.StringVar(&config.ExecRoot, []string{"-exec-root"}, defaultExecRoot, usageFn("Root directory for execution state files"))
|
|
| 119 | 118 |
cmd.BoolVar(&config.AutoRestart, []string{"#r", "#-restart"}, true, usageFn("--restart on the daemon has been deprecated in favor of --restart policies on docker run"))
|
| 120 | 119 |
cmd.StringVar(&config.GraphDriver, []string{"s", "-storage-driver"}, "", usageFn("Storage driver to use"))
|
| 121 | 120 |
cmd.IntVar(&config.Mtu, []string{"#mtu", "-mtu"}, 0, usageFn("Set the containers network MTU"))
|
| ... | ... |
@@ -25,13 +25,14 @@ type Config struct {
|
| 25 | 25 |
|
| 26 | 26 |
// Fields below here are platform specific. |
| 27 | 27 |
|
| 28 |
+ CgroupParent string `json:"cgroup-parent,omitempty"` |
|
| 29 |
+ ContainerdAddr string `json:"containerd,omitempty"` |
|
| 28 | 30 |
CorsHeaders string `json:"api-cors-headers,omitempty"` |
| 29 | 31 |
EnableCors bool `json:"api-enable-cors,omitempty"` |
| 30 | 32 |
EnableSelinuxSupport bool `json:"selinux-enabled,omitempty"` |
| 33 |
+ ExecRoot string `json:"exec-root,omitempty"` |
|
| 31 | 34 |
RemappedRoot string `json:"userns-remap,omitempty"` |
| 32 |
- CgroupParent string `json:"cgroup-parent,omitempty"` |
|
| 33 | 35 |
Ulimits map[string]*units.Ulimit `json:"default-ulimits,omitempty"` |
| 34 |
- ContainerdAddr string `json:"containerd,omitempty"` |
|
| 35 | 36 |
} |
| 36 | 37 |
|
| 37 | 38 |
// bridgeConfig stores all the bridge driver specific |
| ... | ... |
@@ -69,6 +70,7 @@ func (config *Config) InstallFlags(cmd *flag.FlagSet, usageFn func(string) strin |
| 69 | 69 |
cmd.BoolVar(&config.bridgeConfig.EnableIPForward, []string{"#ip-forward", "-ip-forward"}, true, usageFn("Enable net.ipv4.ip_forward"))
|
| 70 | 70 |
cmd.BoolVar(&config.bridgeConfig.EnableIPMasq, []string{"-ip-masq"}, true, usageFn("Enable IP masquerading"))
|
| 71 | 71 |
cmd.BoolVar(&config.bridgeConfig.EnableIPv6, []string{"-ipv6"}, false, usageFn("Enable IPv6 networking"))
|
| 72 |
+ cmd.StringVar(&config.ExecRoot, []string{"-exec-root"}, defaultExecRoot, usageFn("Root directory for execution state files"))
|
|
| 72 | 73 |
cmd.StringVar(&config.bridgeConfig.IP, []string{"#bip", "-bip"}, "", usageFn("Specify network bridge IP"))
|
| 73 | 74 |
cmd.StringVar(&config.bridgeConfig.Iface, []string{"b", "-bridge"}, "", usageFn("Attach containers to a network bridge"))
|
| 74 | 75 |
cmd.StringVar(&config.bridgeConfig.FixedCIDR, []string{"-fixed-cidr"}, "", usageFn("IPv4 subnet for fixed IPs"))
|
| ... | ... |
@@ -7,9 +7,8 @@ import ( |
| 7 | 7 |
) |
| 8 | 8 |
|
| 9 | 9 |
var ( |
| 10 |
- defaultPidFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker.pid"
|
|
| 11 |
- defaultGraph = os.Getenv("programdata") + string(os.PathSeparator) + "docker"
|
|
| 12 |
- defaultExecRoot = defaultGraph |
|
| 10 |
+ defaultPidFile = os.Getenv("programdata") + string(os.PathSeparator) + "docker.pid"
|
|
| 11 |
+ defaultGraph = os.Getenv("programdata") + string(os.PathSeparator) + "docker"
|
|
| 13 | 12 |
) |
| 14 | 13 |
|
| 15 | 14 |
// bridgeConfig stores all the bridge driver specific |
| ... | ... |
@@ -265,8 +265,7 @@ func (cli *DaemonCli) CmdDaemon(args ...string) error {
|
| 265 | 265 |
cli.TrustKeyPath = commonFlags.TrustKey |
| 266 | 266 |
|
| 267 | 267 |
registryService := registry.NewService(cli.Config.ServiceOptions) |
| 268 |
- |
|
| 269 |
- containerdRemote, err := libcontainerd.New(filepath.Join(cli.Config.ExecRoot, "libcontainerd"), cli.getPlatformRemoteOptions()...) |
|
| 268 |
+ containerdRemote, err := libcontainerd.New(cli.getLibcontainerdRoot(), cli.getPlatformRemoteOptions()...) |
|
| 270 | 269 |
if err != nil {
|
| 271 | 270 |
logrus.Fatal(err) |
| 272 | 271 |
} |
| ... | ... |
@@ -6,6 +6,7 @@ import ( |
| 6 | 6 |
"fmt" |
| 7 | 7 |
"os" |
| 8 | 8 |
"os/signal" |
| 9 |
+ "path/filepath" |
|
| 9 | 10 |
"syscall" |
| 10 | 11 |
|
| 11 | 12 |
"github.com/Sirupsen/logrus" |
| ... | ... |
@@ -76,3 +77,9 @@ func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
|
| 76 | 76 |
} |
| 77 | 77 |
return opts |
| 78 | 78 |
} |
| 79 |
+ |
|
| 80 |
+// getLibcontainerdRoot gets the root directory for libcontainerd/containerd to |
|
| 81 |
+// store their state. |
|
| 82 |
+func (cli *DaemonCli) getLibcontainerdRoot() string {
|
|
| 83 |
+ return filepath.Join(cli.Config.ExecRoot, "libcontainerd") |
|
| 84 |
+} |
| ... | ... |
@@ -62,3 +62,10 @@ func setupConfigReloadTrap(configFile string, flags *mflag.FlagSet, reload func( |
| 62 | 62 |
func (cli *DaemonCli) getPlatformRemoteOptions() []libcontainerd.RemoteOption {
|
| 63 | 63 |
return nil |
| 64 | 64 |
} |
| 65 |
+ |
|
| 66 |
+// getLibcontainerdRoot gets the root directory for libcontainerd to store its |
|
| 67 |
+// state. The Windows libcontainerd implementation does not need to write a spec |
|
| 68 |
+// or state to disk, so this is a no-op. |
|
| 69 |
+func (cli *DaemonCli) getLibcontainerdRoot() string {
|
|
| 70 |
+ return "" |
|
| 71 |
+} |