Debian Codegraph @

docs/reference/compose_build.md

raw
1 # docker compose build
2
3 <!---MARKER_GEN_START-->
4 Services are built once and then tagged, by default as `project-service`.
5
6 If the Compose file specifies an
7 [image](https://github.com/compose-spec/compose-spec/blob/main/spec.md#image) name,
8 the image is tagged with that name, substituting any variables beforehand. See
9 [variable interpolation](https://github.com/compose-spec/compose-spec/blob/main/spec.md#interpolation).
10
11 If you change a service's `Dockerfile` or the contents of its build directory,
12 run `docker compose build` to rebuild it.
13
14 ### Options
15
16 | Name | Type | Default | Description |
17 |:----------------------|:--------------|:--------|:------------------------------------------------------------------------------------------------------------|
18 | `--build-arg` | `stringArray` | | Set build-time variables for services |
19 | `--builder` | `string` | | Set builder to use |
20 | `--check` | `bool` | | Check build configuration |
21 | `--dry-run` | `bool` | | Execute command in dry run mode |
22 | `-m`, `--memory` | `bytes` | `0` | Set memory limit for the build container. Not supported by BuildKit. |
23 | `--no-cache` | `bool` | | Do not use cache when building the image |
24 | `--print` | `bool` | | Print equivalent bake file |
25 | `--provenance` | `string` | | Add a provenance attestation |
26 | `--pull` | `bool` | | Always attempt to pull a newer version of the image |
27 | `--push` | `bool` | | Push service images |
28 | `-q`, `--quiet` | `bool` | | Suppress the build output |
29 | `--sbom` | `string` | | Add a SBOM attestation |
30 | `--ssh` | `string` | | Set SSH authentications used when building service images. (use 'default' for using your default SSH Agent) |
31 | `--with-dependencies` | `bool` | | Also build dependencies (transitively) |
32
33
34 <!---MARKER_GEN_END-->
35
36 ## Description
37
38 Services are built once and then tagged, by default as `project-service`.
39
40 If the Compose file specifies an
41 [image](https://github.com/compose-spec/compose-spec/blob/main/spec.md#image) name,
42 the image is tagged with that name, substituting any variables beforehand. See
43 [variable interpolation](https://github.com/compose-spec/compose-spec/blob/main/spec.md#interpolation).
44
45 If you change a service's `Dockerfile` or the contents of its build directory,
46 run `docker compose build` to rebuild it.