Files
docker-docs/compose/reference/build.md
Sebastiaan van Stijn 3a794b3197 (temporarily) replace compose-file deep links to v3 docs
The documentation curently doesn't contain reference docs for the
unified (version-less) compose-file syntax, so for now replacing
all links to point to the v3 compose-file reference, which is still
present.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
2021-01-07 14:21:37 +01:00

1.5 KiB

description, keywords, title, notoc
description keywords title notoc
Build or rebuild services. fig, composition, compose, docker, orchestration, cli, build docker-compose build true
Usage: build [options] [--build-arg key=val...] [SERVICE...]

Options:
    --build-arg key=val     Set build-time variables for services.
    --compress              Compress the build context using gzip.
    --force-rm              Always remove intermediate containers.
    -m, --memory MEM        Set memory limit for the build container.
    --no-cache              Do not use cache when building the image.
    --no-rm                 Do not remove intermediate containers after a successful build.
    --parallel              Build images in parallel.
    --progress string       Set type of progress output (`auto`, `plain`, `tty`).
                            `EXPERIMENTAL` flag for native builder.
                            To enable, run with `COMPOSE_DOCKER_CLI_BUILD=1`)
    --pull                  Always attempt to pull a newer version of the image.
    -q, --quiet             Don't print anything to `STDOUT`.

Services are built once and then tagged, by default as project_service. For example, composetest_db. If the Compose file specifies an image name, the image is tagged with that name, substituting any variables beforehand. See variable substitution.

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