Back to Compose

docker compose build

docs/reference/compose_build.md

5.1.33.6 KB
Original Source

docker compose build

<!---MARKER_GEN_START-->

Services are built once and then tagged, by default as project-service.

If the Compose file specifies an image name, the image is tagged with that name, substituting any variables beforehand. See variable interpolation.

If you change a service's Dockerfile or the contents of its build directory, run docker compose build to rebuild it.

Options

NameTypeDefaultDescription
--build-argstringArraySet build-time variables for services
--builderstringSet builder to use
--checkboolCheck build configuration
--dry-runboolExecute command in dry run mode
-m, --memorybytes0Set memory limit for the build container. Not supported by BuildKit.
--no-cacheboolDo not use cache when building the image
--printboolPrint equivalent bake file
--provenancestringAdd a provenance attestation
--pullboolAlways attempt to pull a newer version of the image
--pushboolPush service images
-q, --quietboolSuppress the build output
--sbomstringAdd a SBOM attestation
--sshstringSet SSH authentications used when building service images. (use 'default' for using your default SSH Agent)
--with-dependenciesboolAlso build dependencies (transitively)
<!---MARKER_GEN_END-->

Description

Services are built once and then tagged, by default as project-service.

If the Compose file specifies an image name, the image is tagged with that name, substituting any variables beforehand. See variable interpolation.

If you change a service's Dockerfile or the contents of its build directory, run docker compose build to rebuild it.