What Does the "docker stop" Command Do?

Find out what the "docker stop" command does

When you use the docker stop command, it attempts a graceful shutdown of the specified container(s). It does so by sending a SIGTERM signal to the main process inside the container. If the container does not comply or complete the shutdown within a grace period (which is 10 seconds by default), then a SIGKILL signal is sent to immediately stop/kill the container.

The grace period timeout is configurable via the --time (or -t shorthand) option. For example, you can allow a graceful shutdown period of 60 seconds in the following way:

docker stop container_name -t 60

Please note that docker stop <container_name> command is synonymous to the new docker container stop <container_name> command. While both work, the latter/newer syntax was introduced to make the commands more verbose, so that the commands are more obvious in what they do.

Hope you found this post useful. It was published . Please show your love and support by sharing this post.