Skip to content

Commit 6075303

Browse files
committed
docs/reference: stop, restart: add flag descriptions
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
1 parent daabb15 commit 6075303

2 files changed

Lines changed: 70 additions & 9 deletions

File tree

docs/reference/commandline/container_restart.md

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Restart one or more 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,3 +22,34 @@ Restart one or more containers
2222
```console
2323
$ docker restart my_container
2424
```
25+
26+
27+
### <a name="signal"></a> Stop container with signal (-s, --signal)
28+
29+
The `--signal` flag sends the system call signal to the container to exit.
30+
This signal can be a signal name in the format `SIG<NAME>`, for instance
31+
`SIGKILL`, or an unsigned number that matches a position in the kernel's
32+
syscall table, for instance `9`. Refer to [signal(7)](https://man7.org/linux/man-pages/man7/signal.7.html)
33+
for available signals.
34+
35+
The default signal to use is defined by the image's [`StopSignal`](https://github.com/opencontainers/image-spec/blob/v1.1.0/config.md),
36+
which can be set through the [`STOPSIGNAL`](https://docs.docker.com/reference/dockerfile/#stopsignal)
37+
Dockerfile instruction when building the image, or configured using the
38+
[`--stop-signal`](https://docs.docker.com/reference/cli/docker/container/run/#stop-signal)
39+
option when creating the container. If no signal is configured for the
40+
container, `SIGTERM` is used as default.
41+
42+
### <a name="time"></a> Stop container with timeout (-t, --timeout)
43+
44+
The `--time` flag sets the number of seconds to wait for the container
45+
to stop after sending the pre-defined (see [`--signal`]{#signal)) system call signal.
46+
If the container does not exit after the timeout elapses, it's forcibly killed
47+
with a `SIGKILL` signal.
48+
49+
If you set `--time` to `-1`, no timeout is applied, and the daemon
50+
waits indefinitely for the container to exit.
51+
52+
The default timeout can be specified using the [`--stop-timeout`](https://docs.docker.com/reference/cli/docker/container/run/#stop-timeout)
53+
option when creating the container. If no default is configured for the container,
54+
the Daemon determines the default, and is 10 seconds for Linux containers, and
55+
30 seconds for Windows containers.

docs/reference/commandline/container_stop.md

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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
2222
The main process inside the container will receive `SIGTERM`, and after a grace
2323
period, `SIGKILL`. The first signal can be changed with the `STOPSIGNAL`
2424
instruction 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

Comments
 (0)