mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #19773 from coolljt0725/fix_message
Correct the info message when stop container
This commit is contained in:
commit
36b5e63179
1 changed files with 5 additions and 4 deletions
|
@ -38,9 +38,10 @@ func (daemon *Daemon) containerStop(container *container.Container, seconds int)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1. Send a SIGTERM
|
stopSignal := container.StopSignal()
|
||||||
if err := daemon.killPossiblyDeadProcess(container, container.StopSignal()); err != nil {
|
// 1. Send a stop signal
|
||||||
logrus.Infof("Failed to send SIGTERM to the process, force killing")
|
if err := daemon.killPossiblyDeadProcess(container, stopSignal); err != nil {
|
||||||
|
logrus.Infof("Failed to send signal %d to the process, force killing", stopSignal)
|
||||||
if err := daemon.killPossiblyDeadProcess(container, 9); err != nil {
|
if err := daemon.killPossiblyDeadProcess(container, 9); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -48,7 +49,7 @@ func (daemon *Daemon) containerStop(container *container.Container, seconds int)
|
||||||
|
|
||||||
// 2. Wait for the process to exit on its own
|
// 2. Wait for the process to exit on its own
|
||||||
if _, err := container.WaitStop(time.Duration(seconds) * time.Second); err != nil {
|
if _, err := container.WaitStop(time.Duration(seconds) * time.Second); err != nil {
|
||||||
logrus.Infof("Container %v failed to exit within %d seconds of SIGTERM - using the force", container.ID, seconds)
|
logrus.Infof("Container %v failed to exit within %d seconds of signal %d - using the force", container.ID, seconds, stopSignal)
|
||||||
// 3. If it doesn't, then send SIGKILL
|
// 3. If it doesn't, then send SIGKILL
|
||||||
if err := daemon.Kill(container); err != nil {
|
if err := daemon.Kill(container); err != nil {
|
||||||
container.WaitStop(-1 * time.Second)
|
container.WaitStop(-1 * time.Second)
|
||||||
|
|
Loading…
Reference in a new issue