# docker compose up Command Reference

> Reference for docker compose up in CI: start services from a compose file with -d, --build, and --wait so dependent services are healthy before tests run.

Source: https://latchkey.dev/learn/command-reference/docker-compose-up-command-reference  
Updated: 2026-06-26

Create and start the services defined in a compose file.

docker compose up builds (if needed), creates, and starts the services in a compose file, along with their network and volumes. In CI you run it detached with -d and ideally --wait so the job only proceeds once services are healthy.

## Common flags

- `-d, --detach` - run services in the background
- `--build` - build images before starting, even if they exist
- `--wait` - block until services are running and healthy
- `--wait-timeout` - seconds to wait before failing
- `--abort-on-container-exit` - stop all services if any container exits
- `--force-recreate` - recreate containers even if config is unchanged

## Example

```shell
docker compose up -d --build --wait
docker compose run --rm app npm run test:e2e
```

## In CI

Use -d --build --wait so the step returns only after every service with a healthcheck reports healthy, eliminating flaky "connection refused" races before tests. --wait requires healthchecks defined in the compose file; without them it returns as soon as containers are running, not ready.

## FAQ

### docker compose up Command Reference?

docker compose up builds (if needed), creates, and starts the services in a compose file, along with their network and volumes. In CI you run it detached with -d and ideally --wait so the job only proceeds once services are healthy.

### In CI?

Use -d --build --wait so the step returns only after every service with a healthcheck reports healthy, eliminating flaky "connection refused" races before tests. --wait requires healthchecks defined in the compose file; without them it returns as soon as containers are running, not ready.

---

Latchkey runs CI/CD that repairs its own failures. Agent entry points: https://latchkey.dev/agent.txt, https://latchkey.dev/openapi.json, https://latchkey.dev/llms.txt
