Home·Terminal commands
Ad

Claim your crypto exchange bonus

Bonuses you get just for signing up. Terms are copied straight from each exchange.

docker compose up

Packages and runtimes

Usage

docker compose up [-d] [--build] [<service>...]

Starts every service in compose.yaml as one project; the hyphenated docker-compose is the retired v1 while docker compose is the v2 plugin, and existing containers are reused unless you pass --build or --force-recreate.

Common flags

FlagMeaning
-dstart in the background
--buildrebuild images before starting
--force-recreatereplace containers even if nothing changed
--remove-orphansclean up containers of services you deleted
--waitreturn only once healthchecks pass
--scale <svc>=<n>run n copies of one service

Examples

docker compose up -d

starts every service in compose.yaml in the background

docker compose up --build web

rebuilds and starts one service

docker compose down -v

stops everything and deletes the named volumes, database data included

The question is always what goes where: inside this project, or on the whole machine.

How to read this

  • Square brackets [ ] mark a part you may leave out.
  • An ellipsis … means you can list more than one.
  • Flags are case-sensitive — in some commands -r and -R do different things.

Questions

QWhat does docker compose up do?

Starts every service in compose.yaml as one project; the hyphenated docker-compose is the retired v1 while docker compose is the v2 plugin, and existing containers are reused unless you pass --build or --force-recreate.

QHow do I type it?

docker compose up [-d] [--build] [<service>...] — square brackets mark the parts you can leave out.

QHow many flags are worth knowing?

6 are listed here; the full set is in man docker. This command sits under Packages and runtimes.

Related commands

man page: man docker-compose-up