Listing, Stopping, Removing
List running containers
docker ps shows active containers. Add -a to include stopped ones.
docker ps
docker ps -a
Stop and start
Stop sends a polite signal so the process can shut down. Start brings a stopped container back.
docker stop my-nginx
docker start my-nginx
Remove a container
A running container must be stopped first (or use -f to force). Removing deletes that instance, not the image.
docker stop my-nginx
docker rm my-nginx
Work by name or ID
Short IDs from docker ps work the same as names. Prefer names for practice so commands stay readable.
docker rm -f my-nginx
Comments
One comment per signed-in account. Comments are saved with this page’s URL.