Scroll to navigation

DOCKER-COMPOSE-BUILD(1) DOCKER-COMPOSE-BUILD(1)

NAME

docker-compose-build - Build or rebuild services

SYNOPSIS

docker compose build [OPTIONS] [SERVICE...]

DESCRIPTION

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

If the Compose file specifies an image ⟨https://github.com/compose-spec/compose-spec/blob/master/spec.md#image⟩ name, the image is tagged with that name, substituting any variables beforehand. See variable interpolation ⟨https://github.com/compose-spec/compose-spec/blob/master/spec.md#interpolation⟩.

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

OPTIONS

--build-arg=[] Set build-time variables for services

--builder="" Set builder to use

-h, --help[=false] help for build

-m, --memory=0 Set memory limit for the build container. Not supported by BuildKit.

--no-cache[=false] Do not use cache when building the image

--pull[=false] Always attempt to pull a newer version of the image

--push[=false] Push service images

-q, --quiet[=false] Don't print anything to STDOUT

--ssh="" Set SSH authentications used when building service images. (use 'default' for using your default SSH Agent)

--with-dependencies[=false] Also build dependencies (transitively)

OPTIONS INHERITED FROM PARENT COMMANDS

--dry-run[=false] Execute command in dry run mode

SEE ALSO

docker-compose(1)

Feb 2025