docker compose build
Build or rebuild services
Usage
docker compose build [OPTIONS] [SERVICE...]
Description
Services are built once and then tagged, by default as project_service
.
If the Compose file specifies an imageopen_in_new name, the image is tagged with that name, substituting any variables beforehand. See variable interpolationopen_in_new.
If you change a service's Dockerfile
or the contents of its build directory,
run docker compose build
to rebuild it.
Options
Option | Short | Default | Description |
---|---|---|---|
--build-arg | Set build-time variables for services. | ||
--builder | Set builder to use. | ||
--compress | true | Compress the build context using gzip. DEPRECATED | |
--force-rm | true | Always remove intermediate containers. DEPRECATED | |
--memory | -m | Set memory limit for the build container. Not supported by BuildKit. | |
--no-cache | Do not use cache when building the image | ||
--no-rm | Do not remove intermediate containers after a successful build. DEPRECATED | ||
--parallel | true | Build images in parallel. DEPRECATED | |
--progress | auto | Set type of ui output (auto, tty, plain, quiet) | |
--pull | Always attempt to pull a newer version of the image. | ||
--push | Push service images. | ||
--quiet | -q | Don't print anything to STDOUT | |
--ssh | Set SSH authentications used when building service images. (use 'default' for using your default SSH Agent) |