These commands are strongly associated with the Docker Container Lifecycle.
It’s recommended to use docker stop
to stop a container first, instead of using docker kill
. The docker stop
command sends a SIGTERM
signal to the container, allowing the container to terminate its processes gracefully and cleanly.
docker stop container_id
If the container doesn’t stop with docker stop
within a specified timeout period, Docker then sends a SIGKILL
signal, which is equivalent to docker kill
command, to the container again to force it to stop.
docker kill container_id
References