docker compose up

Create and start containers defined in a docker-compose.yml file. Builds images if needed.

Syntax

docker compose up [OPTIONS] [SERVICE...]

Examples

Example 1
docker compose up

Start all services in foreground.

Example 2
docker compose up -d

Start all services in detached mode.

Example 3
docker compose up -d --build web

Build and start only the web service.

Example 4
docker compose up -d --force-recreate

Recreate containers even if config unchanged.

Common flags

FlagDescription
-d, --detachRun in background
--buildBuild images before starting
--force-recreateRecreate containers
-q, --quietPull without progress output

Tips & best practices

Related commands

View full Docker cheatsheet →