Skip to content

Commit 3fb4fb8

Browse files
authored
Merge pull request #3245 from thaJeztah/remove_stopsignal_default
create/run: remove default --stop-signal
2 parents e57b5f7 + 214cd05 commit 3fb4fb8

5 files changed

Lines changed: 15 additions & 14 deletions

File tree

cli/command/container/opts.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import (
2020
"github.com/docker/docker/api/types/versions"
2121
"github.com/docker/docker/errdefs"
2222
"github.com/docker/go-connections/nat"
23-
"github.com/moby/sys/signal"
2423
"github.com/pkg/errors"
2524
"github.com/sirupsen/logrus"
2625
"github.com/spf13/pflag"
@@ -183,7 +182,7 @@ func addFlags(flags *pflag.FlagSet) *containerOptions {
183182
flags.Var(&copts.labelsFile, "label-file", "Read in a line delimited file of labels")
184183
flags.BoolVar(&copts.readonlyRootfs, "read-only", false, "Mount the container's root filesystem as read only")
185184
flags.StringVar(&copts.restartPolicy, "restart", "no", "Restart policy to apply when a container exits")
186-
flags.StringVar(&copts.stopSignal, "stop-signal", signal.DefaultStopSignal, "Signal to stop a container")
185+
flags.StringVar(&copts.stopSignal, "stop-signal", "", "Signal to stop the container")
187186
flags.IntVar(&copts.stopTimeout, "stop-timeout", 0, "Timeout (in seconds) to stop a container")
188187
flags.SetAnnotation("stop-timeout", "version", []string{"1.25"})
189188
flags.Var(copts.sysctls, "sysctl", "Sysctl options")
@@ -599,11 +598,9 @@ func parse(flags *pflag.FlagSet, copts *containerOptions, serverOS string) (*con
599598
Entrypoint: entrypoint,
600599
WorkingDir: copts.workingDir,
601600
Labels: opts.ConvertKVStringsToMap(labels),
601+
StopSignal: copts.stopSignal,
602602
Healthcheck: healthConfig,
603603
}
604-
if flags.Changed("stop-signal") {
605-
config.StopSignal = copts.stopSignal
606-
}
607604
if flags.Changed("stop-timeout") {
608605
config.StopTimeout = &copts.stopTimeout
609606
}

docs/reference/commandline/create.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ Options:
108108
The format is `<number><unit>`. `number` must be greater than `0`.
109109
Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes),
110110
or `g` (gigabytes). If you omit the unit, the system uses bytes.
111-
--stop-signal string Signal to stop a container (default "SIGTERM")
111+
--stop-signal string Signal to stop the container
112112
--stop-timeout int Timeout (in seconds) to stop a container
113113
--storage-opt value Storage driver options for the container (default [])
114114
--sysctl value Sysctl options (default map[])

docs/reference/commandline/kill.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ inside the container is sent `SIGKILL` signal (default), or the signal that is
2323
specified with the `--signal` option. You can reference a container by its
2424
ID, ID-prefix, or name.
2525

26-
The `--signal` (or `-s` shorthand) flag sets the system call signal that is sent
27-
to the container. This signal can be a signal name in the format `SIG<NAME>`, for
28-
instance `SIGINT`, or an unsigned number that matches a position in the kernel's
29-
syscall table, for instance `2`.
26+
The `--signal` flag sets the system call signal that is sent to the container.
27+
This signal can be a signal name in the format `SIG<NAME>`, for instance `SIGINT`,
28+
or an unsigned number that matches a position in the kernel's syscall table,
29+
for instance `2`.
3030

3131
While the default (`SIGKILL`) signal will terminate the container, the signal
3232
set through `--signal` may be non-terminal, depending on the container's main

docs/reference/commandline/run.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ Options:
119119
Unit is optional and can be `b` (bytes), `k` (kilobytes), `m` (megabytes),
120120
or `g` (gigabytes). If you omit the unit, the system uses bytes.
121121
--sig-proxy Proxy received signals to the process (default true)
122-
--stop-signal string Signal to stop a container (default "SIGTERM")
122+
--stop-signal string Signal to stop the container
123123
--stop-timeout int Timeout (in seconds) to stop a container
124124
--storage-opt value Storage driver options for the container (default [])
125125
--sysctl value Sysctl options (default map[])
@@ -752,7 +752,8 @@ container to exit. This signal can be a signal name in the format `SIG<NAME>`,
752752
for instance `SIGKILL`, or an unsigned number that matches a position in the
753753
kernel's syscall table, for instance `9`.
754754

755-
The default is `SIGTERM` if not specified.
755+
The default is defined by [`STOPSIGNAL`](https://docs.docker.com/engine/reference/builder/#stopsignal)
756+
in the image, or `SIGTERM` if the image has no `STOPSIGNAL` defined.
756757

757758
### Optional security options (--security-opt)
758759

man/docker-run.1.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,14 +621,17 @@ incompatible with any restart policy other than `none`.
621621
For the `overlay2` storage driver, the size option is only available if the backing fs is `xfs` and mounted with the `pquota` mount option.
622622
Under these conditions, user can pass any size less than the backing fs size.
623623

624-
**--stop-signal**=*SIGTERM*
625-
Signal to stop the container. Default is SIGTERM.
624+
**--stop-signal**=""
625+
Signal to stop the container.
626626

627627
The `--stop-signal` flag sets the system call signal that will be sent to the
628628
container to exit. This signal can be a signal name in the format `SIG<NAME>`,
629629
for instance `SIGKILL`, or an unsigned number that matches a position in the
630630
kernel's syscall table, for instance `9`.
631631

632+
The default is defined by `STOPSIGNAL` in the image, or `SIGTERM` if the image
633+
has no `STOPSIGNAL` defined.
634+
632635
**--stop-timeout**
633636
Timeout (in seconds) to stop a container, or **-1** to disable timeout.
634637

0 commit comments

Comments
 (0)