2018-05-23 15:15:21 -04:00
|
|
|
package supervisor // import "github.com/docker/docker/libcontainerd/supervisor"
|
2017-09-22 09:52:41 -04:00
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
2018-05-23 15:15:21 -04:00
|
|
|
|
|
|
|
"github.com/docker/docker/pkg/system"
|
2017-09-22 09:52:41 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
grpcPipeName = `\\.\pipe\docker-containerd-containerd`
|
|
|
|
debugPipeName = `\\.\pipe\docker-containerd-debug`
|
|
|
|
)
|
|
|
|
|
|
|
|
func (r *remote) setDefaults() {
|
|
|
|
if r.GRPC.Address == "" {
|
|
|
|
r.GRPC.Address = grpcPipeName
|
|
|
|
}
|
|
|
|
if r.Debug.Address == "" {
|
|
|
|
r.Debug.Address = debugPipeName
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func (r *remote) stopDaemon() {
|
|
|
|
p, err := os.FindProcess(r.daemonPid)
|
|
|
|
if err != nil {
|
|
|
|
r.logger.WithField("pid", r.daemonPid).Warn("could not find daemon process")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
if err = p.Kill(); err != nil {
|
|
|
|
r.logger.WithError(err).WithField("pid", r.daemonPid).Warn("could not kill daemon process")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
_, err = p.Wait()
|
|
|
|
if err != nil {
|
|
|
|
r.logger.WithError(err).WithField("pid", r.daemonPid).Warn("wait for daemon process")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-05-23 15:15:21 -04:00
|
|
|
func (r *remote) killDaemon() {
|
|
|
|
system.KillProcess(r.daemonPid)
|
|
|
|
}
|
|
|
|
|
2017-09-22 09:52:41 -04:00
|
|
|
func (r *remote) platformCleanup() {
|
|
|
|
// Nothing to do
|
|
|
|
}
|