# docker compose build Command Reference

> Reference for docker compose build in CI: build service images defined in a compose file with --no-cache, --pull, and --build-arg in pipelines.

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

Build the images for services defined in a compose file.

docker compose build builds (or rebuilds) the images for services that have a build section. It is separate from up so CI can build images in one step, then start them in another, or build without starting anything.

## Common flags

- `--no-cache` - build without using the layer cache
- `--pull` - always pull a newer base image
- `--build-arg KEY=value` - pass a build-time ARG
- `--progress` - output style, e.g. plain for full CI logs
- Positional service names limit the build to those services

## Example

```shell
docker compose build --pull --build-arg NODE_ENV=production app worker
docker compose up -d --wait
```

## In CI

Use --progress plain so BuildKit emits full, non-collapsed logs that are readable in CI output. Building explicitly before up makes the build step a distinct, cacheable stage; --pull keeps base images patched on scheduled builds.

## FAQ

### docker compose build Command Reference?

docker compose build builds (or rebuilds) the images for services that have a build section. It is separate from up so CI can build images in one step, then start them in another, or build without starting anything.

### In CI?

Use --progress plain so BuildKit emits full, non-collapsed logs that are readable in CI output. Building explicitly before up makes the build step a distinct, cacheable stage; --pull keeps base images patched on scheduled builds.

---

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
