Docker Engine 29 reference · Docker Compose
docker compose up Command (Docker CLI)
Create and start every service of a Compose project; -d runs in the background and --wait returns once services are healthy.
Docker Engine 29
Syntax
docker compose up [OPTIONS] [SERVICE...]
Parameters
| Parameter | Description |
|---|---|
-d |
Detached mode. |
--wait |
Wait until services are running and healthy. |
--build |
Build images before starting. |
-p NAME |
Project name (defaults to the directory name). |
Examples
cat > compose.yaml <<'EOF'
services:
cache:
image: redis:8-alpine
healthcheck: {test: ["CMD", "redis-cli", "ping"], interval: 1s, retries: 20}
EOF
docker compose -p rc-ref-up up -d --wait > /dev/null 2>&1
docker compose -p rc-ref-up ps --format '{{.Service}}: {{.State}} ({{.Health}})'
docker compose -p rc-ref-up down > /dev/null 2>&1
Output
cache: running (healthy)
Run this on your computer — see “Get Started” for setup.
cat > compose.yaml <<'EOF'
services:
job:
image: alpine:3.24
command: echo one-off task done
EOF
docker compose -p rc-ref-up2 up 2>/dev/null | grep -o 'one-off task done'
docker compose -p rc-ref-up2 down > /dev/null 2>&1
Output
one-off task done
Run this on your computer — see “Get Started” for setup.
Related
docker compose down· Stop and remove a Compose project's containers and networks; -v also deletes its named volumes and their data.docker compose config· Validate the Compose files and print the final configuration after merging overrides and interpolating variables.- Docker Compose Basics · tutorial
- Startup Order and Healthchecks · tutorial