mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
configure docker-init binary path
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
b826bebda0
commit
6a12685bb7
6 changed files with 25 additions and 3 deletions
|
@ -324,4 +324,7 @@ type HostConfig struct {
|
||||||
|
|
||||||
// Run a custom init inside the container, if null, use the daemon's configured settings
|
// Run a custom init inside the container, if null, use the daemon's configured settings
|
||||||
Init *bool `json:",omitempty"`
|
Init *bool `json:",omitempty"`
|
||||||
|
|
||||||
|
// Custom init path
|
||||||
|
InitPath string `json:",omitempty"`
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ type Config struct {
|
||||||
DefaultRuntime string `json:"default-runtime,omitempty"`
|
DefaultRuntime string `json:"default-runtime,omitempty"`
|
||||||
OOMScoreAdjust int `json:"oom-score-adjust,omitempty"`
|
OOMScoreAdjust int `json:"oom-score-adjust,omitempty"`
|
||||||
Init bool `json:"init,omitempty"`
|
Init bool `json:"init,omitempty"`
|
||||||
|
InitPath string `json:"init-path,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// bridgeConfig stores all the bridge driver specific
|
// bridgeConfig stores all the bridge driver specific
|
||||||
|
@ -93,6 +94,7 @@ func (config *Config) InstallFlags(flags *pflag.FlagSet) {
|
||||||
flags.StringVar(&config.DefaultRuntime, "default-runtime", stockRuntimeName, "Default OCI runtime for containers")
|
flags.StringVar(&config.DefaultRuntime, "default-runtime", stockRuntimeName, "Default OCI runtime for containers")
|
||||||
flags.IntVar(&config.OOMScoreAdjust, "oom-score-adjust", -500, "Set the oom_score_adj for the daemon")
|
flags.IntVar(&config.OOMScoreAdjust, "oom-score-adjust", -500, "Set the oom_score_adj for the daemon")
|
||||||
flags.BoolVar(&config.Init, "init", false, "Run an init in the container to forward signals and reap processes")
|
flags.BoolVar(&config.Init, "init", false, "Run an init in the container to forward signals and reap processes")
|
||||||
|
flags.StringVar(&config.InitPath, "init-path", "", "Path to the docker-init binary")
|
||||||
|
|
||||||
config.attachExperimentalFlags(flags)
|
config.attachExperimentalFlags(flags)
|
||||||
}
|
}
|
||||||
|
|
|
@ -594,10 +594,19 @@ func (daemon *Daemon) populateCommonSpec(s *specs.Spec, c *container.Container)
|
||||||
if (c.HostConfig.Init != nil && *c.HostConfig.Init) ||
|
if (c.HostConfig.Init != nil && *c.HostConfig.Init) ||
|
||||||
(c.HostConfig.Init == nil && daemon.configStore.Init) {
|
(c.HostConfig.Init == nil && daemon.configStore.Init) {
|
||||||
s.Process.Args = append([]string{"/dev/init", c.Path}, c.Args...)
|
s.Process.Args = append([]string{"/dev/init", c.Path}, c.Args...)
|
||||||
path, err := exec.LookPath("docker-init")
|
var path string
|
||||||
|
if daemon.configStore.InitPath == "" && c.HostConfig.InitPath == "" {
|
||||||
|
path, err = exec.LookPath("docker-init")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
if daemon.configStore.InitPath != "" {
|
||||||
|
path = daemon.configStore.InitPath
|
||||||
|
}
|
||||||
|
if c.HostConfig.InitPath != "" {
|
||||||
|
path = c.HostConfig.InitPath
|
||||||
|
}
|
||||||
s.Mounts = append(s.Mounts, specs.Mount{
|
s.Mounts = append(s.Mounts, specs.Mount{
|
||||||
Destination: "/dev/init",
|
Destination: "/dev/init",
|
||||||
Type: "bind",
|
Type: "bind",
|
||||||
|
|
|
@ -49,6 +49,7 @@ Options:
|
||||||
--help Print usage
|
--help Print usage
|
||||||
--icc=true Enable inter-container communication
|
--icc=true Enable inter-container communication
|
||||||
--init Run an init inside containers to forward signals and reap processes
|
--init Run an init inside containers to forward signals and reap processes
|
||||||
|
--init-path Path to the docker-init binary
|
||||||
--insecure-registry=[] Enable insecure registry communication
|
--insecure-registry=[] Enable insecure registry communication
|
||||||
--ip=0.0.0.0 Default IP when binding container ports
|
--ip=0.0.0.0 Default IP when binding container ports
|
||||||
--ip-forward=true Enable net.ipv4.ip_forward
|
--ip-forward=true Enable net.ipv4.ip_forward
|
||||||
|
@ -1142,6 +1143,7 @@ This is a full example of the allowed configuration options on Linux:
|
||||||
"cgroup-parent": "",
|
"cgroup-parent": "",
|
||||||
"default-ulimits": {},
|
"default-ulimits": {},
|
||||||
"init": false,
|
"init": false,
|
||||||
|
"init-path": "/usr/libexec/docker-init",
|
||||||
"ipv6": false,
|
"ipv6": false,
|
||||||
"iptables": false,
|
"iptables": false,
|
||||||
"ip-forward": false,
|
"ip-forward": false,
|
||||||
|
|
|
@ -35,6 +35,7 @@ dockerd - Enable daemon mode
|
||||||
[**--help**]
|
[**--help**]
|
||||||
[**--icc**[=*true*]]
|
[**--icc**[=*true*]]
|
||||||
[**--init**[=*false*]]
|
[**--init**[=*false*]]
|
||||||
|
[**--init-path**[=*""*]]
|
||||||
[**--insecure-registry**[=*[]*]]
|
[**--insecure-registry**[=*[]*]]
|
||||||
[**--ip**[=*0.0.0.0*]]
|
[**--ip**[=*0.0.0.0*]]
|
||||||
[**--ip-forward**[=*true*]]
|
[**--ip-forward**[=*true*]]
|
||||||
|
@ -170,6 +171,9 @@ unix://[/path/to/socket] to use.
|
||||||
**--init**
|
**--init**
|
||||||
Run an init process inside containers for signal forwarding and process reaping.
|
Run an init process inside containers for signal forwarding and process reaping.
|
||||||
|
|
||||||
|
**--init-path**
|
||||||
|
Path to the docker-init binary.
|
||||||
|
|
||||||
**--insecure-registry**=[]
|
**--insecure-registry**=[]
|
||||||
Enable insecure registry communication, i.e., enable un-encrypted and/or untrusted communication.
|
Enable insecure registry communication, i.e., enable un-encrypted and/or untrusted communication.
|
||||||
|
|
||||||
|
|
|
@ -104,6 +104,7 @@ type ContainerOptions struct {
|
||||||
runtime string
|
runtime string
|
||||||
autoRemove bool
|
autoRemove bool
|
||||||
init bool
|
init bool
|
||||||
|
initPath string
|
||||||
|
|
||||||
Image string
|
Image string
|
||||||
Args []string
|
Args []string
|
||||||
|
@ -246,6 +247,7 @@ func AddFlags(flags *pflag.FlagSet) *ContainerOptions {
|
||||||
flags.StringVar(&copts.runtime, "runtime", "", "Runtime to use for this container")
|
flags.StringVar(&copts.runtime, "runtime", "", "Runtime to use for this container")
|
||||||
|
|
||||||
flags.BoolVar(&copts.init, "init", false, "Run an init inside the container that forwards signals and reaps processes")
|
flags.BoolVar(&copts.init, "init", false, "Run an init inside the container that forwards signals and reaps processes")
|
||||||
|
flags.StringVar(&copts.initPath, "init-path", "", "Path to the docker-init binary")
|
||||||
return copts
|
return copts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue