зеркало из https://github.com/microsoft/docker.git
Send sigterm and wait forever
Docker-DCO-1.1-Signed-off-by: Michael Crosby <michael@crosbymichael.com> (github: crosbymichael)
This commit is contained in:
Родитель
e36d89b0f9
Коммит
93779cc7fe
|
@ -915,7 +915,6 @@ func (container *Container) Stop(seconds int) error {
|
|||
|
||||
// 1. Send a SIGTERM
|
||||
if err := container.KillSig(15); err != nil {
|
||||
utils.Debugf("Error sending kill SIGTERM: %s", err)
|
||||
log.Print("Failed to send SIGTERM to the process, force killing")
|
||||
if err := container.KillSig(9); err != nil {
|
||||
return err
|
||||
|
|
|
@ -797,13 +797,18 @@ func (runtime *Runtime) shutdown() error {
|
|||
group := sync.WaitGroup{}
|
||||
utils.Debugf("starting clean shutdown of all containers...")
|
||||
for _, container := range runtime.List() {
|
||||
if container.State.IsRunning() {
|
||||
utils.Debugf("stopping %s", container.ID)
|
||||
c := container
|
||||
if c.State.IsRunning() {
|
||||
utils.Debugf("stopping %s", c.ID)
|
||||
group.Add(1)
|
||||
|
||||
go func() {
|
||||
defer group.Done()
|
||||
container.Stop(10)
|
||||
if err := c.KillSig(15); err != nil {
|
||||
utils.Debugf("kill 15 error for %s - %s", c.ID, err)
|
||||
}
|
||||
c.Wait()
|
||||
utils.Debugf("container stopped %s", c.ID)
|
||||
}()
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче