Docker Containers
20%
Stopping Containers
You can use the stop subcommand in the following way to stop one or multiple containers:
docker stop [OPTIONS] CONTAINER [CONTAINER...]
Example:
docker stop my_nginx
By default, the docker stop command asks the container to terminate gracefully: it sends SIGTERM to the container's PID 1 and waits (10 seconds by default) for the process to exit. If the process is still running after the wait period, Docker sends SIGKILL to force termination. You can change the wait time with the --time (or -t) flag:
# start the container again
docker start my_nginx
# stop the container after 20 seconds (wait 20s for graceful shutdown)
docker stop --time=20 my_nginx
# orPainless Docker - 2nd Edition
A Comprehensive Guide to Mastering Docker and its EcosystemEnroll now to unlock all content and receive all future updates for free.
Unlock now  $31.99$25.59Learn More
Hurry! This limited time offer ends in:
To redeem this offer, copy the coupon code below and apply it at checkout:
