2022-03-09 12:57:07 +01:00
|
|
|
# docker compose build
|
|
|
|
|
|
|
|
<!---MARKER_GEN_START-->
|
2024-07-17 11:27:58 +02:00
|
|
|
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.
|
2022-03-09 12:57:07 +01:00
|
|
|
|
|
|
|
### Options
|
|
|
|
|
2023-12-20 15:18:29 +01:00
|
|
|
| Name | Type | Default | Description |
|
|
|
|
|:----------------------|:--------------|:--------|:------------------------------------------------------------------------------------------------------------|
|
2024-02-14 20:02:37 +01:00
|
|
|
| `--build-arg` | `stringArray` | | Set build-time variables for services |
|
|
|
|
| `--builder` | `string` | | Set builder to use |
|
2024-07-17 11:27:58 +02:00
|
|
|
| `--dry-run` | `bool` | | Execute command in dry run mode |
|
2023-12-20 15:18:29 +01:00
|
|
|
| `-m`, `--memory` | `bytes` | `0` | Set memory limit for the build container. Not supported by BuildKit. |
|
2024-07-17 11:27:58 +02:00
|
|
|
| `--no-cache` | `bool` | | Do not use cache when building the image |
|
|
|
|
| `--pull` | `bool` | | Always attempt to pull a newer version of the image |
|
|
|
|
| `--push` | `bool` | | Push service images |
|
|
|
|
| `-q`, `--quiet` | `bool` | | Don't print anything to STDOUT |
|
2023-12-20 15:18:29 +01:00
|
|
|
| `--ssh` | `string` | | Set SSH authentications used when building service images. (use 'default' for using your default SSH Agent) |
|
2024-07-17 11:27:58 +02:00
|
|
|
| `--with-dependencies` | `bool` | | Also build dependencies (transitively) |
|
2022-03-09 12:57:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
<!---MARKER_GEN_END-->
|
2021-06-08 09:39:49 +02:00
|
|
|
|
|
|
|
## Description
|
|
|
|
|
2024-03-20 03:06:45 +01:00
|
|
|
Services are built once and then tagged, by default as `project-service`.
|
2021-06-08 09:39:49 +02:00
|
|
|
|
|
|
|
If the Compose file specifies an
|
2022-03-09 13:24:09 +01:00
|
|
|
[image](https://github.com/compose-spec/compose-spec/blob/master/spec.md#image) name,
|
2021-06-08 09:39:49 +02:00
|
|
|
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).
|
|
|
|
|
2022-03-09 13:24:09 +01:00
|
|
|
If you change a service's `Dockerfile` or the contents of its build directory,
|
2021-09-13 17:14:32 +02:00
|
|
|
run `docker compose build` to rebuild it.
|