Ad space (banner)
AD

Got the fundamentals? A structured Docker course is a fast way to level up.

Find Docker courses on Udemy

Affiliate link. Costs you nothing extra.

🐳Docker Lessons
Lesson 12 / 45

Stopping a Container with docker stop

When you want to stop a running container cleanly, use docker stop. It asks the process to shut down gracefully.

The syntax is docker stop container, naming the container or its ID. Docker sends a termination signal and waits, by default 10 seconds, before forcing the issue.

Running docker stop web stops the container named web and prints its name back.

A common stumble is confusing stop with docker rm. Stopping leaves the container in place — it can be started again; removing deletes it.

In real work, graceful stops matter: they give databases and servers a chance to finish writing and close connections properly.

Docker
Try it (type this into the pseudo terminal)
docker stop web

🧑‍💻 You can type this command into the Docker pseudo terminal to try it yourself (this page itself has no interactive terminal).

Ad space (banner)
Ad space (in-article)