Docker-DCO-1.1-Signed-off-by: Brian Goff <cpuguy83@gmail.com> (github: cpuguy83)
| ... | ... |
@@ -477,8 +477,8 @@ func (cli *DockerCli) CmdInfo(args ...string) error {
|
| 477 | 477 |
} |
| 478 | 478 |
|
| 479 | 479 |
func (cli *DockerCli) CmdStop(args ...string) error {
|
| 480 |
- cmd := cli.Subcmd("stop", "[OPTIONS] CONTAINER [CONTAINER...]", "Stop a running container (Send SIGTERM, and then SIGKILL after grace period)")
|
|
| 481 |
- nSeconds := cmd.Int([]string{"t", "-time"}, 10, "Number of seconds to wait for the container to stop before killing it.")
|
|
| 480 |
+ cmd := cli.Subcmd("stop", "[OPTIONS] CONTAINER [CONTAINER...]", "Stop a running container (Send SIGTERM)")
|
|
| 481 |
+ nSeconds := cmd.Int([]string{"t", "-time"}, 10, "Number of seconds to wait for the container to stop.")
|
|
| 482 | 482 |
if err := cmd.Parse(args); err != nil {
|
| 483 | 483 |
return nil |
| 484 | 484 |
} |
| ... | ... |
@@ -505,7 +505,7 @@ func (cli *DockerCli) CmdStop(args ...string) error {
|
| 505 | 505 |
|
| 506 | 506 |
func (cli *DockerCli) CmdRestart(args ...string) error {
|
| 507 | 507 |
cmd := cli.Subcmd("restart", "[OPTIONS] CONTAINER [CONTAINER...]", "Restart a running container")
|
| 508 |
- nSeconds := cmd.Int([]string{"t", "-time"}, 10, "Number of seconds to try to stop for before killing the container. Once killed it will then be restarted. Default=10")
|
|
| 508 |
+ nSeconds := cmd.Int([]string{"t", "-time"}, 10, "Number of seconds to wait for the container to stop. Default=10")
|
|
| 509 | 509 |
if err := cmd.Parse(args); err != nil {
|
| 510 | 510 |
return nil |
| 511 | 511 |
} |
| ... | ... |
@@ -432,7 +432,7 @@ Stop a container |
| 432 | 432 |
|
| 433 | 433 |
HTTP/1.1 204 OK |
| 434 | 434 |
|
| 435 |
- :query t: number of seconds to wait before killing the container |
|
| 435 |
+ :query t: number of seconds to wait for the container to stop |
|
| 436 | 436 |
:statuscode 204: no error |
| 437 | 437 |
:statuscode 404: no such container |
| 438 | 438 |
:statuscode 500: server error |
| ... | ... |
@@ -457,7 +457,7 @@ Restart a container |
| 457 | 457 |
|
| 458 | 458 |
HTTP/1.1 204 OK |
| 459 | 459 |
|
| 460 |
- :query t: number of seconds to wait before killing the container |
|
| 460 |
+ :query t: number of seconds to wait for the container to stop |
|
| 461 | 461 |
:statuscode 204: no error |
| 462 | 462 |
:statuscode 404: no such container |
| 463 | 463 |
:statuscode 500: server error |
| ... | ... |
@@ -1366,11 +1366,11 @@ This example shows 5 containers that might be set up to test a web application c |
| 1366 | 1366 |
|
| 1367 | 1367 |
Usage: docker stop [OPTIONS] CONTAINER [CONTAINER...] |
| 1368 | 1368 |
|
| 1369 |
- Stop a running container (Send SIGTERM, and then SIGKILL after grace period) |
|
| 1369 |
+ Stop a running container (Send SIGTERM) |
|
| 1370 | 1370 |
|
| 1371 |
- -t, --time=10: Number of seconds to wait for the container to stop before killing it. |
|
| 1371 |
+ -t, --time=10: Number of seconds to wait for the container to stop. |
|
| 1372 | 1372 |
|
| 1373 |
-The main process inside the container will receive SIGTERM, and after a grace period, SIGKILL |
|
| 1373 |
+The main process inside the container will receive SIGTERM. |
|
| 1374 | 1374 |
|
| 1375 | 1375 |
.. _cli_tag: |
| 1376 | 1376 |
|
| ... | ... |
@@ -890,20 +890,12 @@ func (container *Container) Stop(seconds int) error {
|
| 890 | 890 |
|
| 891 | 891 |
// 1. Send a SIGTERM |
| 892 | 892 |
if err := container.KillSig(15); err != nil {
|
| 893 |
- utils.Debugf("Error sending kill SIGTERM: %s", err)
|
|
| 894 |
- log.Print("Failed to send SIGTERM to the process, force killing")
|
|
| 895 |
- if err := container.KillSig(9); err != nil {
|
|
| 896 |
- return err |
|
| 897 |
- } |
|
| 893 |
+ return err |
|
| 898 | 894 |
} |
| 899 | 895 |
|
| 900 | 896 |
// 2. Wait for the process to exit on its own |
| 901 | 897 |
if err := container.WaitTimeout(time.Duration(seconds) * time.Second); err != nil {
|
| 902 |
- log.Printf("Container %v failed to exit within %d seconds of SIGTERM - using the force", container.ID, seconds)
|
|
| 903 |
- // 3. If it doesn't, then send SIGKILL |
|
| 904 |
- if err := container.Kill(); err != nil {
|
|
| 905 |
- return err |
|
| 906 |
- } |
|
| 898 |
+ return err |
|
| 907 | 899 |
} |
| 908 | 900 |
return nil |
| 909 | 901 |
} |