moby--moby/daemon
Sebastiaan van Stijn 83a185897d
API: add "signal" parameter to container stop and restart endpoints
Containers can have a default stop-signal (`--stop-signal` / `STOPSIGNAL`) and
timeout (`--stop-timeout`). It is currently not possible to update either of
these after the container is created (`docker update` does not allow updating
them), and while either of these can be overridden through some commands, we
currently do not have a command that can override *both*:

command         | stop-signal | stop-timeout | notes
----------------|-------------|--------------|----------------------------
docker kill     | yes         | DNA          | only sends a single signal
docker restart  | no          | yes          |
docker stop     | no          | yes          |

As a result, if a user wants to stop a container with a custom signal and
timeout, the only option is to do this manually:

    docker kill -s <custom signal> mycontainer
    # wait <desired timeout>
    # press ^C to cancel the graceful stop
    # forcibly kill the container
    docker kill mycontainer

This patch adds a new `signal` query parameter to the container "stop" and
"restart" endpoints. This parameter can be added as a new flag on the CLI,
which would allow stopping and restarting with a custom timeout and signal,
for example:

    docker stop --signal=SIGWINCH --time=120 mycontainer

    docker restart --signal=SIGWINCH --time=120 mycontainer

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2022-04-20 21:29:31 +02:00
..
cluster backend: add StopOptions to ContainerRestart and ContainerStop 2022-04-20 21:29:30 +02:00
config daemon: move DefaultShutdownTimeout to daemon/config 2022-04-17 13:11:03 +02:00
events
exec
graphdriver daemon/graphdriver: remove unused graphdriver.IsInitialized() 2022-04-07 16:21:31 +02:00
images Remove comment that is no longer relevant 2022-03-24 19:04:33 +01:00
initlayer
links
listeners
logger daemon/logger/fluentd: remove udp, tcp+tls, unixgram, add tls scheme 2022-04-11 18:02:13 +02:00
names
network
stats
testdata
apparmor_default.go
apparmor_default_unsupported.go
archive.go
archive_tarcopyoptions.go Finish refactor of UID/GID usage to a new struct 2022-03-14 16:28:57 -04:00
archive_tarcopyoptions_unix.go
archive_tarcopyoptions_windows.go
archive_unix.go
archive_windows.go
attach.go
auth.go daemon: unexport Daemon.ID and Daemon.RegistryService 2022-03-02 22:19:22 +01:00
changes.go
checkpoint.go
cluster.go
commit.go
configs.go
configs_linux.go
configs_unsupported.go
configs_windows.go
container.go
container_linux.go daemon: load and cache sysInfo on initialization 2022-01-12 18:28:15 +01:00
container_operations.go
container_operations_unix.go
container_operations_windows.go
container_unix_test.go
container_windows.go
content.go daemon: rename some variables, import-aliases and receivers 2022-04-20 21:22:28 +02:00
create.go daemon: cleanupContainer(): pass ContainerRmConfig as parameter 2022-04-20 21:27:24 +02:00
create_test.go
create_unix.go
create_windows.go
daemon.go backend: add StopOptions to ContainerRestart and ContainerStop 2022-04-20 21:29:30 +02:00
daemon_linux.go
daemon_linux_test.go
daemon_test.go
daemon_unix.go Merge pull request #43366 from corhere/finish-identitymapping-refactor 2022-03-25 14:51:05 +01:00
daemon_unix_test.go
daemon_unsupported.go daemon: load and cache sysInfo on initialization 2022-01-12 18:28:15 +01:00
daemon_windows.go Merge pull request #43366 from corhere/finish-identitymapping-refactor 2022-03-25 14:51:05 +01:00
daemon_windows_test.go
debugtrap_unix.go
debugtrap_unsupported.go
debugtrap_windows.go
delete.go backend: add StopOptions to ContainerRestart and ContainerStop 2022-04-20 21:29:30 +02:00
delete_test.go
dependency.go
devices_linux.go
disk_usage.go
errors.go filters: lowercase error 2022-03-18 09:44:53 +01:00
events.go daemon: unexport Daemon.ID and Daemon.RegistryService 2022-03-02 22:19:22 +01:00
events_test.go
exec.go
exec_linux.go oci: inheritable capability set should be empty 2022-02-08 14:33:44 -08:00
exec_linux_test.go
exec_windows.go
export.go Finish refactor of UID/GID usage to a new struct 2022-03-14 16:28:57 -04:00
health.go
health_test.go
info.go daemon: require storage-driver to be set if the driver is deprecated 2022-03-25 15:22:06 +01:00
info_unix.go version: add RootlessKit, slirp4netns, and VPNKit version 2022-03-15 15:44:42 +09:00
info_unix_test.go
info_windows.go
inspect.go
inspect_linux.go
inspect_test.go
inspect_windows.go
keys.go
keys_unsupported.go
kill.go
licensing.go
licensing_test.go
links.go
list.go
list_test.go filters: lowercase error 2022-03-18 09:44:53 +01:00
list_unix.go
list_windows.go
logdrivers_linux.go
logdrivers_windows.go
logs.go
logs_test.go
metrics.go daemon: use RWMutex for stateCounter 2022-02-15 18:04:18 +01:00
metrics_unix.go
metrics_unsupported.go
monitor.go
mounts.go
names.go
network.go
network_windows.go
nvidia_linux.go
oci_linux.go Merge pull request #43366 from corhere/finish-identitymapping-refactor 2022-03-25 14:51:05 +01:00
oci_linux_test.go Finish refactor of UID/GID usage to a new struct 2022-03-14 16:28:57 -04:00
oci_utils.go
oci_windows.go Implement :// separator for arbitrary Windows Device IDTypes 2022-03-27 13:26:47 +11:00
oci_windows_test.go Implement :// separator for arbitrary Windows Device IDTypes 2022-03-27 13:26:47 +11:00
pause.go
prune.go
reload.go daemon/config: move proxy settings to "proxies" struct within daemon.json 2022-04-07 19:43:02 +02:00
reload_test.go daemon: unexport Daemon.ID and Daemon.RegistryService 2022-03-02 22:19:22 +01:00
reload_unix.go
reload_windows.go
rename.go
resize.go
resize_test.go
restart.go backend: add StopOptions to ContainerRestart and ContainerStop 2022-04-20 21:29:30 +02:00
runtime_unix.go
runtime_windows.go
seccomp_disabled.go
seccomp_linux.go daemon: load and cache sysInfo on initialization 2022-01-12 18:28:15 +01:00
seccomp_linux_test.go daemon: rename some variables, import-aliases and receivers 2022-04-20 21:22:28 +02:00
seccomp_unsupported.go
secrets.go
secrets_linux.go
secrets_unsupported.go
secrets_windows.go
start.go
start_unix.go
start_windows.go
stats.go
stats_collector.go
stats_unix.go
stats_windows.go
stop.go API: add "signal" parameter to container stop and restart endpoints 2022-04-20 21:29:31 +02:00
top_unix.go
top_unix_test.go
top_windows.go
trustkey.go
trustkey_test.go
unpause.go
update.go
update_linux.go
update_windows.go
util_test.go
volumes.go
volumes_linux.go
volumes_linux_test.go
volumes_unit_test.go
volumes_unix.go
volumes_unix_test.go
volumes_windows.go
wait.go
workdir.go