Merge pull request #6962 from erikh/3349-cleanup-docker-socket
Clean up the docker socket on termination of the daemon.
This commit is contained in:
commit
c3045f563d
1 changed files with 14 additions and 0 deletions
|
@ -87,6 +87,18 @@ func InitPidfile(job *engine.Job) engine.Status {
|
|||
return engine.StatusOK
|
||||
}
|
||||
|
||||
func (srv *Server) removeUnixSockets() {
|
||||
for _, sock := range srv.daemon.Config().Sockets {
|
||||
parts := strings.SplitN(sock, "://", 2)
|
||||
if parts[0] == "unix" {
|
||||
err := os.Remove(parts[1])
|
||||
if err != nil {
|
||||
utils.Debugf("Got error removing unix socket: %s", err.Error())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// jobInitApi runs the remote api server `srv` as a daemon,
|
||||
// Only one api server can run at the same time - this is enforced by a pidfile.
|
||||
// The signals SIGINT, SIGQUIT and SIGTERM are intercepted for cleanup.
|
||||
|
@ -125,6 +137,8 @@ func InitServer(job *engine.Job) engine.Status {
|
|||
}
|
||||
case syscall.SIGQUIT:
|
||||
}
|
||||
|
||||
srv.removeUnixSockets()
|
||||
os.Exit(128 + int(sig.(syscall.Signal)))
|
||||
}(sig)
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue