@@ -9,10 +9,10 @@ Stop one or more running containers
99
1010### Options
1111
12- | Name | Type | Default | Description |
13- | :-----------------| :---------| :--------| :---------------------------------------------|
14- | ` -s ` , ` --signal ` | ` string ` | | Signal to send to the container |
15- | ` -t ` , ` --time ` | ` int ` | ` 0 ` | Seconds to wait before killing the container |
12+ | Name | Type | Default | Description |
13+ | :--------------------------------------- | :---------| :--------| :---------------------------------------------|
14+ | [ ` -s ` ] ( #signal ) , [ ` --signal ` ] ( #signal ) | ` string ` | | Signal to send to the container |
15+ | [ ` -t ` ] ( #time ) , [ ` --time ` ] ( #time ) | ` int ` | ` 0 ` | Seconds to wait before killing the container |
1616
1717
1818<!-- -MARKER_GEN_END-->
@@ -22,10 +22,40 @@ Stop one or more running containers
2222The main process inside the container will receive ` SIGTERM ` , and after a grace
2323period, ` SIGKILL ` . The first signal can be changed with the ` STOPSIGNAL `
2424instruction in the container's Dockerfile, or the ` --stop-signal ` option to
25- ` docker run ` .
25+ ` docker run ` and ` docker create ` .
2626
2727## Examples
2828
2929``` console
3030$ docker stop my_container
3131```
32+
33+ ### <a name =" signal " ></a > Stop container with signal (-s, --signal)
34+
35+ The ` --signal ` flag sends the system call signal to the container to exit.
36+ This signal can be a signal name in the format ` SIG<NAME> ` , for instance
37+ ` SIGKILL ` , or an unsigned number that matches a position in the kernel's
38+ syscall table, for instance ` 9 ` . Refer to [ signal(7)] ( https://man7.org/linux/man-pages/man7/signal.7.html )
39+ for available signals.
40+
41+ The default signal to use is defined by the image's [ ` StopSignal ` ] ( https://github.com/opencontainers/image-spec/blob/v1.1.0/config.md ) ,
42+ which can be set through the [ ` STOPSIGNAL ` ] ( https://docs.docker.com/reference/dockerfile/#stopsignal )
43+ Dockerfile instruction when building the image, or configured using the
44+ [ ` --stop-signal ` ] ( https://docs.docker.com/reference/cli/docker/container/run/#stop-signal )
45+ option when creating the container. If no signal is configured for the
46+ container, ` SIGTERM ` is used as default.
47+
48+ ### <a name =" time " ></a > Stop container with timeout (-t, --timeout)
49+
50+ The ` --time ` flag sets the number of seconds to wait for the container
51+ to stop after sending the pre-defined (see [ ` --signal ` ] {#signal)) system call signal.
52+ If the container does not exit after the timeout elapses, it's forcibly killed
53+ with a ` SIGKILL ` signal.
54+
55+ If you set ` --time ` to ` -1 ` , no timeout is applied, and the daemon
56+ waits indefinitely for the container to exit.
57+
58+ The default timeout can be specified using the [ ` --stop-timeout ` ] ( https://docs.docker.com/reference/cli/docker/container/run/#stop-timeout )
59+ option when creating the container. If no default is configured for the container,
60+ the Daemon determines the default, and is 10 seconds for Linux containers, and
61+ 30 seconds for Windows containers.
0 commit comments