🐳 Docker Compose Basics: `up`, `down`, `stop`, and `start` Explained Simply
SOVANNARO

SOVANNARO @sovannaro

About: Passionate developer specializing in JavaScript, TypeScript, React, Vue, and Angular. I thrive on solving problems and building innovative solutions that make a difference in the modern world.

Location:
Phnom Penh, Cambodia
Joined:
Dec 1, 2021

🐳 Docker Compose Basics: `up`, `down`, `stop`, and `start` Explained Simply

Publish Date: Jul 26 '25
0 0

Working with multiple microservices? Docker Compose is your best friend. It lets you start, stop, and manage multiple containers using just a few commands.

In this post, you'll learn the difference between:

  • docker compose up
  • docker compose down
  • docker compose stop
  • docker compose start

🔼 docker compose up

This command creates and starts your containers based on the docker-compose.yml file.

docker compose up -d
Enter fullscreen mode Exit fullscreen mode
  • -d = “detached mode” – run containers in the background
  • It builds containers if they don’t already exist
  • Useful for starting fresh or restarting your entire system

🔽 docker compose down

This command stops and removes all containers, networks, and volumes created by Docker Compose.

docker compose down
Enter fullscreen mode Exit fullscreen mode
  • Cleans up everything
  • Helps save space on your machine
  • Use it when you're done or want to restart everything fresh

🛑 docker compose stop

This command only stops your running containers. It does not delete them.

docker compose stop
Enter fullscreen mode Exit fullscreen mode

Use this when:

  • You want to pause development
  • You plan to restart the containers later without rebuilding

▶️ docker compose start

This command restarts containers that were previously stopped using stop.

docker compose start
Enter fullscreen mode Exit fullscreen mode

⚠️ If the containers were removed using down, this command won't work — they no longer exist.


💡 Real Example Flow

Here’s a typical workflow when using Docker Compose:

# Start all services
docker compose up -d

# Stop them without removing
docker compose stop

# Start them again
docker compose start

# Stop and remove everything
docker compose down
Enter fullscreen mode Exit fullscreen mode

✅ Summary Table

Command Action Removes Containers?
docker compose up Builds & runs containers ❌ No
docker compose stop Stops containers only ❌ No
docker compose start Starts containers that were stopped ❌ No
docker compose down Stops and removes everything ✅ Yes

🔍 Final Notes

  • Most of the time, you'll use up and down.
  • If you're working on a project temporarily, stop and start are great tools to keep things light.
  • Always double-check your docker-compose.yml file — correct indentation is very important!

Let me know if you'd like me to add:

  • A visual diagram to help reinforce this flow
  • A downloadable cheat sheet
  • A GitHub sample project

Happy Dockering! 🐳


Comments 0 total

    Add comment