|
@@ -72,6 +72,7 @@ type Daemon struct {
|
|
init bool
|
|
init bool
|
|
dockerdBinary string
|
|
dockerdBinary string
|
|
log logT
|
|
log logT
|
|
|
|
+ pidFile string
|
|
|
|
|
|
// swarm related field
|
|
// swarm related field
|
|
swarmListenAddr string
|
|
swarmListenAddr string
|
|
@@ -246,11 +247,15 @@ func (d *Daemon) StartWithLogFile(out *os.File, providedArgs ...string) error {
|
|
return errors.Wrapf(err, "[%s] could not find docker binary in $PATH", d.id)
|
|
return errors.Wrapf(err, "[%s] could not find docker binary in $PATH", d.id)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if d.pidFile == "" {
|
|
|
|
+ d.pidFile = filepath.Join(d.Folder, "docker.pid")
|
|
|
|
+ }
|
|
|
|
+
|
|
args := append(d.GlobalFlags,
|
|
args := append(d.GlobalFlags,
|
|
"--containerd", containerdSocket,
|
|
"--containerd", containerdSocket,
|
|
"--data-root", d.Root,
|
|
"--data-root", d.Root,
|
|
"--exec-root", d.execRoot,
|
|
"--exec-root", d.execRoot,
|
|
- "--pidfile", fmt.Sprintf("%s/docker.pid", d.Folder),
|
|
|
|
|
|
+ "--pidfile", d.pidFile,
|
|
fmt.Sprintf("--userland-proxy=%t", d.userlandProxy),
|
|
fmt.Sprintf("--userland-proxy=%t", d.userlandProxy),
|
|
"--containerd-namespace", d.id,
|
|
"--containerd-namespace", d.id,
|
|
"--containerd-plugins-namespace", d.id+"p",
|
|
"--containerd-plugins-namespace", d.id+"p",
|
|
@@ -395,7 +400,10 @@ func (d *Daemon) Kill() error {
|
|
return err
|
|
return err
|
|
}
|
|
}
|
|
|
|
|
|
- return os.Remove(fmt.Sprintf("%s/docker.pid", d.Folder))
|
|
|
|
|
|
+ if d.pidFile != "" {
|
|
|
|
+ _ = os.Remove(d.pidFile)
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
|
|
|
|
// Pid returns the pid of the daemon
|
|
// Pid returns the pid of the daemon
|
|
@@ -512,7 +520,10 @@ out2:
|
|
|
|
|
|
d.cmd.Wait()
|
|
d.cmd.Wait()
|
|
|
|
|
|
- return os.Remove(fmt.Sprintf("%s/docker.pid", d.Folder))
|
|
|
|
|
|
+ if d.pidFile != "" {
|
|
|
|
+ _ = os.Remove(d.pidFile)
|
|
|
|
+ }
|
|
|
|
+ return nil
|
|
}
|
|
}
|
|
|
|
|
|
// Restart will restart the daemon by first stopping it and the starting it.
|
|
// Restart will restart the daemon by first stopping it and the starting it.
|