1
0
Fork 0
mirror of https://github.com/moby/moby.git synced 2022-11-09 12:21:53 -05:00
moby--moby/api/server/router
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
..
build api/server: build: refactor for better readability 2019-12-04 16:19:01 +01:00
checkpoint api/server/httputils: add ReadJSON() utility 2022-04-11 21:37:51 +02:00
container API: add "signal" parameter to container stop and restart endpoints 2022-04-20 21:29:31 +02:00
debug Switch from x/net/context -> context 2018-04-23 13:52:44 -07:00
distribution Remove more of registry v1 code. 2021-02-23 09:49:46 +01:00
grpc api/server/router/grpc: fix some nits in NewRouter() 2022-04-07 16:06:15 +02:00
image search: remove parsing JSON filters out of the backend 2022-03-18 09:44:55 +01:00
network api/server/httputils: add ReadJSON() utility 2022-04-11 21:37:51 +02:00
plugin api/server/httputils: add ReadJSON() utility 2022-04-11 21:37:51 +02:00
session move /session api endpoint out of experimental 2018-08-21 22:43:34 +00:00
swarm api/server/httputils: add ReadJSON() utility 2022-04-11 21:37:51 +02:00
system API: add "Swarm" header to _ping endpoint 2022-03-25 23:54:14 +01:00
volume api/server/httputils: add ReadJSON() utility 2022-04-11 21:37:51 +02:00
experimental.go fix typos 2018-09-01 21:26:38 +08:00
local.go api/server/router: use consts for HTTP methods 2019-11-26 21:55:29 +01:00
router.go Add canonical import comment 2018-02-05 16:51:57 -05:00