How to stop a Docker container?
A container is stopped with the docker stop command.
1. View running containers
bash
docker ps2. Stop the container
By name:
bash
docker stop CONTAINER_NAMEor by ID:
bash
docker stop CONTAINER_ID3. Force stop (if the container is not responding)
bash
docker kill CONTAINER_NAMEstop sends a SIGTERM signal (graceful stop), while kill sends SIGKILL (instantly terminates the process).
Important point
After stopping, the container remains in the docker ps -a list, and it can be started again with:
bash
docker start CONTAINER_NAMEShort Answer
Interview readyPremium
A concise answer to help you respond confidently on this topic during an interview.