Menu
Coddy logo textTech

Stopping And Removing

Part of the Introduction to Docker section of Coddy's Terminal journey — lesson 15 of 40.

To stop a running container, use docker stop with its name or ID:

docker stop web

The container moves from Up to Exited, but it still exists. To delete a stopped container for good, use docker rm:

docker rm web

Docker refuses to rm a container that is still running, to protect you from mistakes. If you really mean it, force removal with -f:

docker rm -f web
challenge icon

Challenge

Easy

Start a detached redis container named db, then stop it, then list all containers so you can see its Exited status.

Cheat sheet

Stop a running container (moves to Exited state but still exists):

docker stop web

Remove a stopped container permanently:

docker rm web

Force remove a running container:

docker rm -f web

Try it yourself

Terminal
quiz iconTest yourself

This lesson includes a short quiz. Start the lesson to answer it and track your progress.

All lessons in Introduction to Docker