docker-compose up Explained

What docker-compose up does, with an example.

Published November 8, 2026

docker compose up creates and starts all the services defined in docker-compose.yml: networks, volumes and containers in one command.

How it works

Use -d to run in the background, --build to rebuild images and --force-recreate to recreate containers. Compose creates a default network so services reach each other by name.

Environment files and profiles customise what starts.

Try it

docker compose up -d
[+] Running 3/3
✔ Network app_default Created
✔ Container app-db-1 Started
✔ Container app-web-1 Started

Practical examples

Start in background

docker compose up -d

Rebuild images

docker compose up -d --build

Only some services

docker compose up -d web db

Follow logs

docker compose logs -f web

Common mistakes

  • Using localhost between containers (use service names).
  • Not rebuilding after code changes.
  • Hard-coding secrets in the compose file.

Key takeaways

  • docker compose up creates and starts all the services defined in docker-compose.yml: networks, volumes and containers in one command.
  • Run docker <command> --help for all options.
  • Clean up unused resources regularly.

FAQ

up vs start?

up creates what is missing; start only restarts existing containers.

Where can I see all options?

Run the command with --help.

More General articles