ENGDOCS-2184 (#20641)

* ENGDOCS-2184

* fix more links

* remove numbers from file names

* final link fix

* this is really the last fix
This commit is contained in:
Allie Sadler 2024-08-19 11:45:34 +01:00 committed by GitHub
parent 3d5b40fc20
commit 52b3d97da7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
76 changed files with 252 additions and 220 deletions

View File

@ -6,7 +6,7 @@ aliases:
- /build/customize/bake/compose-file/
---
Bake supports the [Compose file format](../../compose/compose-file/_index.md)
Bake supports the [Compose file format](/reference/compose-file/_index.md)
to parse a Compose file and translate each service to a [target](reference.md#target).
```yaml
@ -75,7 +75,7 @@ $ docker buildx bake --print
The compose format has some limitations compared to the HCL format:
- Specifying variables or global scope attributes is not yet supported
- `inherits` service field is not supported, but you can use [YAML anchors](../../compose/compose-file/10-fragments.md)
- `inherits` service field is not supported, but you can use [YAML anchors](/reference/compose-file/fragments.md)
to reference other services, as demonstrated in the previous example with `&build-dev`.
## `.env` file
@ -128,7 +128,7 @@ $ docker buildx bake --print
## Extension field with `x-bake`
Where some fields are not available in the compose specification, you can use
the [special extension](../../compose/compose-file/11-extension.md) field
the [special extension](/reference/compose-file/extension.md) field
`x-bake` in your compose file to evaluate extra fields:
```yaml

View File

@ -31,7 +31,7 @@ grid:
description: Find information on defining services, networks, and volumes for a
Docker application.
icon: polyline
link: /compose/compose-file
link: /reference/compose-file
- title: Browse common FAQs
description: Explore general FAQs and find out how to give feedback.
icon: help

View File

@ -60,7 +60,7 @@ You can check the [Compose Specification JSON schema](https://github.com/compose
As part of the Go templating syntax, Compose Bridge offers a set of YAML helper functions designed to manipulate data within the templates efficiently:
- `seconds`: Converts a [duration](https://github.com/compose-spec/compose-spec/blob/master/11-extension.md#specifying-durations) into an integer
- `seconds`: Converts a [duration](/reference/compose-file/extension.md#specifying-durations) into an integer
- `uppercase`: Converts a string into upper case characters
- `title`: Converts a string by capitalizing the first letter of each word
- `safe`: Converts a string into a safe identifier, replacing all characters (except lowercase a-z) with `-`

View File

@ -9,7 +9,7 @@ keywords: compose, bridge, kubernetes
Compose Bridge supplies an out-of-the box transformation for your Compose configuration file. Based on an arbitrary `compose.yaml` file, Compose Bridge produces:
- A [Namespace](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/) so all your resources are isolated and don't conflict with resources from other deployments.
- A [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) with an entry for each and every [config](../compose-file/08-configs.md) resource in your Compose application.
- A [ConfigMap](https://kubernetes.io/docs/concepts/configuration/configmap/) with an entry for each and every [config](/reference/compose-file/configs.md) resource in your Compose application.
- [Deployments](https://kubernetes.io/docs/concepts/workloads/controllers/deployment/) for application services. This ensures that the specified number of instances of your application are maintained in the Kubernetes cluster.
- [Services](https://kubernetes.io/docs/concepts/services-networking/service/) for ports exposed by your services, used for service-to-service communication.
- [Services](https://kubernetes.io/docs/concepts/services-networking/service/) for ports published by your services, with type `LoadBalancer` so that Docker Desktop will also expose the same port on the host.

View File

@ -9,25 +9,25 @@ aliases:
With Docker Compose you use a YAML configuration file, known as the [Compose file](#the-compose-file), to configure your applications services, and then you create and start all the services from your configuration with the [Compose CLI](#cli).
The Compose file, or `compose.yaml` file, follows the rules provided by the [Compose Specification](compose-file/_index.md) in how to define multi-container applications. This is the Docker Compose implementation of the formal [Compose Specification](https://github.com/compose-spec/compose-spec).
The Compose file, or `compose.yaml` file, follows the rules provided by the [Compose Specification](/reference/compose-file/_index.md) in how to define multi-container applications. This is the Docker Compose implementation of the formal [Compose Specification](https://github.com/compose-spec/compose-spec).
{{< accordion title="The Compose application model" >}}
Computing components of an application are defined as [services](compose-file/05-services.md). A service is an abstract concept implemented on platforms by running the same container image, and configuration, one or more times.
Computing components of an application are defined as [services](/reference/compose-file/services.md). A service is an abstract concept implemented on platforms by running the same container image, and configuration, one or more times.
Services communicate with each other through [networks](compose-file/06-networks.md). In the Compose Specification, a network is a platform capability abstraction to establish an IP route between containers within services connected together.
Services communicate with each other through [networks](/reference/compose-file/networks.md). In the Compose Specification, a network is a platform capability abstraction to establish an IP route between containers within services connected together.
Services store and share persistent data into [volumes](compose-file/07-volumes.md). The Specification describes such a persistent data as a high-level filesystem mount with global options.
Services store and share persistent data into [volumes](/reference/compose-file/volumes.md). The Specification describes such a persistent data as a high-level filesystem mount with global options.
Some services require configuration data that is dependent on the runtime or platform. For this, the Specification defines a dedicated [configs](compose-file/08-configs.md) concept. From a service container point of view, configs are comparable to volumes, in that they are files mounted into the container. But the actual definition involves distinct platform resources and services, which are abstracted by this type.
Some services require configuration data that is dependent on the runtime or platform. For this, the Specification defines a dedicated [configs](/reference/compose-file/configs.md) concept. From a service container point of view, configs are comparable to volumes, in that they are files mounted into the container. But the actual definition involves distinct platform resources and services, which are abstracted by this type.
A [secret](compose-file/09-secrets.md) is a specific flavor of configuration data for sensitive data that should not be exposed without security considerations. Secrets are made available to services as files mounted into their containers, but the platform-specific resources to provide sensitive data are specific enough to deserve a distinct concept and definition within the Compose specification.
A [secret](/reference/compose-file/secrets.md) is a specific flavor of configuration data for sensitive data that should not be exposed without security considerations. Secrets are made available to services as files mounted into their containers, but the platform-specific resources to provide sensitive data are specific enough to deserve a distinct concept and definition within the Compose specification.
>**Note**
>
> With volumes, configs and secrets you can have a simple declaration at the top-level and then add more platform-specific information at the service level.
A project is an individual deployment of an application specification on a platform. A project's name, set with the top-level [`name`](compose-file/04-version-and-name.md) attribute, is used to group
A project is an individual deployment of an application specification on a platform. A project's name, set with the top-level [`name`](/reference/compose-file/version-and-name.md) attribute, is used to group
resources together and isolate them from other applications or other installation of the same Compose-specified application with distinct parameters. If you are creating resources on a platform, you must prefix resource names by project and
set the label `com.docker.compose.project`.
@ -41,15 +41,15 @@ The default path for a Compose file is `compose.yaml` (preferred) or `compose.ym
Compose also supports `docker-compose.yaml` and `docker-compose.yml` for backwards compatibility of earlier versions.
If both files exist, Compose prefers the canonical `compose.yaml`.
You can use [fragments](compose-file/10-fragments.md) and [extensions](compose-file/11-extension.md) to keep your Compose file efficient and easy to maintain.
You can use [fragments](/reference/compose-file/fragments.md) and [extensions](/reference/compose-file/extension.md) to keep your Compose file efficient and easy to maintain.
Multiple Compose files can be [merged](13-merge.md) together to define the application model. The combination of YAML files is implemented by appending or overriding YAML elements based on the Compose file order you set.
Multiple Compose files can be [merged](/reference/compose-file/merge.md) together to define the application model. The combination of YAML files is implemented by appending or overriding YAML elements based on the Compose file order you set.
Simple attributes and maps get overridden by the highest order Compose file, lists get merged by appending. Relative
paths are resolved based on the first Compose file's parent folder, whenever complimentary files being
merged are hosted in other folders. As some Compose file elements can both be expressed as single strings or complex objects, merges apply to
the expanded form. For more information, see [Working with multiple Compose files](multiple-compose-files/_index.md)
If you want to reuse other Compose files, or factor out parts of your application model into separate Compose files, you can also use [`include`](compose-file/14-include.md). This is useful if your Compose application is dependent on another application which is managed by a different team, or needs to be shared with others.
If you want to reuse other Compose files, or factor out parts of your application model into separate Compose files, you can also use [`include`](/reference/compose-file/include.md). This is useful if your Compose application is dependent on another application which is managed by a different team, or needs to be shared with others.
## CLI
@ -162,4 +162,4 @@ example-backend-1 example/database "docker-entrypoint.s…" backend
- [Quickstart](gettingstarted.md)
- [Explore some sample applications](samples-for-compose.md)
- [Familiarize yourself with the Compose Specification](compose-file/_index.md)
- [Familiarize yourself with the Compose Specification](/reference/compose-file/_index.md)

View File

@ -17,7 +17,7 @@ A container's environment is not set until there's an explicit entry in the serv
## Use the `environment` attribute
You can set environment variables directly in your container's environment with the
[`environment` attribute](../compose-file/05-services.md#environment) in your `compose.yml`.
[`environment` attribute](/reference/compose-file/services.md#environment) in your `compose.yml`.
It supports both list and mapping syntax:
@ -35,7 +35,7 @@ services:
- DEBUG=true
```
See [`environment` attribute](../compose-file/05-services.md#environment) for more examples on how to use it.
See [`environment` attribute](/reference/compose-file/services.md#environment) for more examples on how to use it.
### Additional information
@ -57,7 +57,7 @@ The value of the `DEBUG` variable in the container is taken from the value for t
## Use the `env_file` attribute
A container's environment can also be set using [`.env` files](variable-interpolation.md#env-file) along with the [`env_file` attribute](../compose-file/05-services.md#env_file).
A container's environment can also be set using [`.env` files](variable-interpolation.md#env-file) along with the [`env_file` attribute](/reference/compose-file/services.md#env_file).
```yaml
services:
@ -69,7 +69,7 @@ Using an `.env` file lets you to use the same file for use by a plain `docker ru
It can also help you keep your environment variables separate from your main configuration file, providing a more organized and secure way to manage sensitive information, as you do not need to place your `.env` file in the root of your project's directory.
The [`env_file` attribute](../compose-file/05-services.md#env_file) also lets you use multiple `.env` files in your Compose application.
The [`env_file` attribute](/reference/compose-file/services.md#env_file) also lets you use multiple `.env` files in your Compose application.
The paths to your `.env` file, specified in the `env_file` attribute, are relative to the location of your `compose.yml` file.

View File

@ -52,7 +52,7 @@ For braced expressions, the following formats are supported:
- `${VAR:+replacement}` -> `replacement` if `VAR` is set and non-empty, otherwise empty
- `${VAR+replacement}` -> `replacement` if `VAR` is set, otherwise empty
For more information, see [Interpolation](../compose-file/12-interpolation.md) in the Compose Specification.
For more information, see [Interpolation](/reference/compose-file/interpolation.md) in the Compose Specification.
## Ways to set variables with interpolation
@ -95,7 +95,7 @@ services:
#### Additional information
- If you define a variable in your `.env` file, you can reference it directly in your `compose.yml` with the [`environment` attribute](../compose-file/05-services.md#environment). For example, if your `.env` file contains the environment variable `DEBUG=1` and your `compose.yml` file looks like this:
- If you define a variable in your `.env` file, you can reference it directly in your `compose.yml` with the [`environment` attribute](/reference/compose-file/services.md#environment). For example, if your `.env` file contains the environment variable `DEBUG=1` and your `compose.yml` file looks like this:
```yaml
services:
webapp:

View File

@ -201,4 +201,4 @@ We are actively looking for feedback on this feature. Give feedback or report an
## Reference
- [Compose Develop Specification](compose-file/develop.md)
- [Compose Develop Specification](/reference/compose-file/develop.md)

View File

@ -348,5 +348,5 @@ This is a simplified example, but it demonstrates the basic principle of `includ
- Try the [Sample apps with Compose](https://github.com/docker/awesome-compose)
- [Explore the full list of Compose commands](reference/index.md)
- [Explore the Compose file reference](compose-file/index.md)
- [Explore the Compose file reference](/reference/compose-file/index.md)
- [Check out the Learning Docker Compose video on LinkedIn Learning](https://www.linkedin.com/learning/learning-docker-compose/)

View File

@ -11,7 +11,7 @@ You can use either `docker-compose` or `docker compose` commands. For more infor
## Enabling GPU access to service containers
GPUs are referenced in a `compose.yml` file using the [device](compose-file/deploy.md#devices) attribute from the Compose Deploy specification, within your services that need them.
GPUs are referenced in a `compose.yml` file using the [device](/reference/compose-file/deploy.md#devices) attribute from the Compose Deploy specification, within your services that need them.
This provides more granular control over a GPU reservation as custom values can be set for the following device properties:
@ -28,7 +28,7 @@ This provides more granular control over a GPU reservation as custom values can
>
> `count` and `device_ids` are mutually exclusive. You must only define one field at a time.
For more information on these properties, see the [Compose Deploy Specification](compose-file/deploy.md#devices).
For more information on these properties, see the [Compose Deploy Specification](/reference/compose-file/deploy.md#devices).
### Example of a Compose file for running a service with access to 1 GPU device

View File

@ -31,7 +31,7 @@ When you're developing software, the ability to run an application in an
isolated environment and interact with it is crucial. The Compose command
line tool can be used to create the environment and interact with it.
The [Compose file](../compose-file/_index.md) provides a way to document and configure
The [Compose file](/reference/compose-file/_index.md) provides a way to document and configure
all of the application's service dependencies (databases, queues, caches,
web service APIs, etc). Using the Compose command line tool you can create
and start one or more containers for each dependency with a single command
@ -46,7 +46,7 @@ started guide" to a single machine-readable Compose file and a few commands.
An important part of any Continuous Deployment or Continuous Integration process
is the automated test suite. Automated end-to-end testing requires an
environment in which to run tests. Compose provides a convenient way to create
and destroy isolated testing environments for your test suite. By defining the full environment in a [Compose file](../compose-file/_index.md), you can create and destroy these environments in just a few commands:
and destroy isolated testing environments for your test suite. By defining the full environment in a [Compose file](/reference/compose-file/_index.md), you can create and destroy these environments in just a few commands:
```console
$ docker compose up -d

View File

@ -15,7 +15,7 @@ This page provides:
![Image showing the main differences between Compose V1 and Compose V2](../images/v1-versus-v2.png)
The image above shows that the currently supported version of the Docker Compose CLI is Compose V2 which is defined by the [Compose Specification](../compose-file/_index.md).
The image above shows that the currently supported version of the Docker Compose CLI is Compose V2 which is defined by the [Compose Specification](/reference/compose-file/_index.md).
It also provides a quick snapshot of the differences in file formats, command-line syntax, and top-level elements. This is covered in more detail in the following sections.
@ -41,8 +41,8 @@ Its usage is historical and files written in this format don't run with Compose
Compose file format 2.x and 3.x are very similar to each other, but the latter introduced many new options targeted at Swarm deployments.
To address confusion around Compose CLI versioning, Compose file format versioning, and feature parity depending on whether Swarm mode was in use, file format 2.x and 3.x were merged into the [Compose Specification](../compose-file/_index.md).
To address confusion around Compose CLI versioning, Compose file format versioning, and feature parity depending on whether Swarm mode was in use, file format 2.x and 3.x were merged into the [Compose Specification](/reference/compose-file/_index.md).
Compose V2 uses the Compose Specification for project definition. Unlike the prior file formats, the Compose Specification is rolling and makes the `version` top-level element optional. Compose V2 also makes use of optional specifications - [Deploy](../compose-file/deploy.md), [Develop](../compose-file/develop.md) and [Build](../compose-file/build.md).
Compose V2 uses the Compose Specification for project definition. Unlike the prior file formats, the Compose Specification is rolling and makes the `version` top-level element optional. Compose V2 also makes use of optional specifications - [Deploy](/reference/compose-file/deploy.md), [Develop](/reference/compose-file/develop.md) and [Build](/reference/compose-file/build.md).
To make [migration](../migrate.md) easier, Compose V2 has backwards compatibility for certain elements that have been deprecated or changed between Compose file format 2.x/3.x and the Compose Specification.

View File

@ -7,7 +7,7 @@ aliases:
- /compose/extends/
---
Docker Compose's [`extends` attribute](../compose-file/05-services.md#extends)
Docker Compose's [`extends` attribute](/reference/compose-file/services.md#extends)
lets you share common configurations among different files, or even different
projects entirely.
@ -205,4 +205,4 @@ services:
## Reference information
- [`extends`](../compose-file/05-services.md#extends)
- [`extends`](/reference/compose-file/services.md#extends)

View File

@ -8,7 +8,7 @@ title: Include
{{< include "compose/include.md" >}}
The [`include` top-level element](../compose-file/14-include.md) helps to reflect the engineering team responsible for the code directly in the config file's organization. It also solves the relative path problem that [`extends`](extends.md) and [merge](merge.md) present.
The [`include` top-level element](/reference/compose-file/include.md) helps to reflect the engineering team responsible for the code directly in the config file's organization. It also solves the relative path problem that [`extends`](extends.md) and [merge](merge.md) present.
Each path listed in the `include` section loads as an individual Compose application model, with its own project directory, in order to resolve relative paths.
@ -77,4 +77,4 @@ Combined together, this allows you to benefit from third-party reusable componen
## Reference information
[`include` top-level element](../compose-file/14-include.md)
[`include` top-level element](/reference/compose-file/include.md)

View File

@ -14,7 +14,7 @@ services.
If a service is defined in both files, Compose merges the configurations using
the rules described below and in the
[Compose Specification](../compose-file/13-merge.md).
[Compose Specification](/reference/compose-file/merge.md).
## How to merge multiple Compose files
@ -273,7 +273,7 @@ services:
- ./local:/baz
```
For more merging rules, see [Merge and override](../compose-file/13-merge.md) in the Compose Specification.
For more merging rules, see [Merge and override](/reference/compose-file/merge.md) in the Compose Specification.
## Example
@ -367,4 +367,4 @@ With such a constraint, code organization in a monorepo can become hard as a nat
## Reference information
- [Merge rules](../compose-file/13-merge.md)
- [Merge rules](/reference/compose-file/merge.md)

View File

@ -80,14 +80,14 @@ services:
image: postgres
```
See the [links reference](compose-file/05-services.md#links) for more information.
See the [links reference](/reference/compose-file/services.md#links) for more information.
## Multi-host networking
When deploying a Compose application on a Docker Engine with [Swarm mode enabled](../engine/swarm/_index.md),
you can make use of the built-in `overlay` driver to enable multi-host communication.
Overlay networks are always created as `attachable`. You can optionally set the [`attachable`](compose-file/06-networks.md#attachable) property to `false`.
Overlay networks are always created as `attachable`. You can optionally set the [`attachable`](/reference/compose-file/networks.md#attachable) property to `false`.
Consult the [Swarm mode section](../engine/swarm/_index.md), to see how to set up
a Swarm cluster, and the [Getting started with multi-host networking](/engine/network/tutorials/overlay.md)
@ -129,9 +129,9 @@ networks:
bar: "2"
```
Networks can be configured with static IP addresses by setting the [ipv4_address and/or ipv6_address](compose-file/05-services.md#ipv4_address-ipv6_address) for each attached network.
Networks can be configured with static IP addresses by setting the [ipv4_address and/or ipv6_address](/reference/compose-file/services.md#ipv4_address-ipv6_address) for each attached network.
Networks can also be given a [custom name](compose-file/06-networks.md#name):
Networks can also be given a [custom name](/reference/compose-file/networks.md#name):
```yaml
services:
@ -163,7 +163,7 @@ networks:
## Use a pre-existing network
If you want your containers to join a pre-existing network, use the [`external` option](compose-file/06-networks.md#external)
If you want your containers to join a pre-existing network, use the [`external` option](/reference/compose-file/networks.md#external)
```yaml
services:
# ...
@ -179,5 +179,5 @@ Instead of attempting to create a network called `[projectname]_default`, Compos
For full details of the network configuration options available, see the following references:
- [Top-level `networks` element](compose-file/06-networks.md)
- [Service-level `networks` attribute](compose-file/05-services.md#networks)
- [Top-level `networks` element](/reference/compose-file/networks.md)
- [Service-level `networks` attribute](/reference/compose-file/services.md#networks)

View File

@ -22,7 +22,7 @@ production. These changes might include:
- Binding to different ports on the host
- Setting environment variables differently, such as reducing the verbosity of
logging, or to specify settings for external services such as an email server
- Specifying a restart policy like [`restart: always`](compose-file/05-services.md#restart)to avoid downtime
- Specifying a restart policy like [`restart: always`](/reference/compose-file/services.md#restart)to avoid downtime
- Adding extra services such as a log aggregator
For this reason, consider defining an additional Compose file, for example

View File

@ -9,7 +9,7 @@ keywords: cli, compose, profile, profiles reference
## Assigning profiles to services
Services are associated with profiles through the
[`profiles` attribute](compose-file/05-services.md#profiles) which takes an
[`profiles` attribute](/reference/compose-file/services.md#profiles) which takes an
array of profile names:
```yaml
@ -173,4 +173,4 @@ $ COMPOSE_PROFILES=dev docker compose up phpmyadmin
## Reference information
[`profiles`](compose-file/05-services.md#profiles)
[`profiles`](/reference/compose-file/services.md#profiles)

View File

@ -32,7 +32,7 @@ The precedence order for each method, from highest to lowest, is as follows:
1. The `-p` command line flag.
2. The [COMPOSE_PROJECT_NAME environment variable](environment-variables/envvars.md).
3. The [top-level `name:` attribute](compose-file/04-version-and-name.md) in your Compose file. Or the last `name:` if you [specify multiple Compose files](multiple-compose-files/merge.md) in the command line with the `-f` flag.
3. The [top-level `name:` attribute](/reference/compose-file/version-and-name.md) in your Compose file. Or the last `name:` if you [specify multiple Compose files](multiple-compose-files/merge.md) in the command line with the `-f` flag.
4. The base name of the project directory containing your Compose file. Or the base name of the first Compose file if you [specify multiple Compose files](multiple-compose-files/merge.md) in the command line with the `-f` flag.
5. The base name of the current directory if no Compose file is specified.

View File

@ -78,4 +78,4 @@ You can use Docker Compose binary, `docker compose [-f <arg>...] [options]
- [Specify a project name](../project-name.md)
- [Using environment variables](../environment-variables/_index.md)
- [Working with multiple Compose files](../multiple-compose-files/_index.md)
- [Compose Specification](../compose-file/_index.md)
- [Compose Specification](/reference/compose-file/_index.md)

View File

@ -2321,7 +2321,7 @@ naming scheme accordingly before upgrading.
- Added support for `extra_hosts` in build configuration
- Added support for the [long syntax](compose-file/legacy-versions.md) for volume entries, as previously introduced in the 3.2 format.
- Added support for the [long syntax](/reference/compose-file/legacy-versions.md) for volume entries, as previously introduced in the 3.2 format.
Using this syntax will create [mounts](/engine/storage/bind-mounts.md) instead of volumes.
#### Compose file version 2.1 and up
@ -3257,7 +3257,7 @@ naming scheme accordingly before upgrading.
You don't have to use it - your existing Compose files will run on Compose
1.6 exactly as they do today.
Check the [upgrade guide](../compose/compose-file/legacy-versions.md)
Check the [upgrade guide](/reference/compose-file/legacy-versions.md)
for full details.
- Support for networking has exited experimental status and is the recommended

View File

@ -13,7 +13,7 @@ if you have not already done so.
The samples should help you to:
- Define services based on Docker images using
[Compose files](compose-file/index.md): `compose.yml` and
[Compose files](/reference/compose-file/index.md): `compose.yml` and
`docker-stack.yml`
- Understand the relationship between `compose.yml` and
[Dockerfiles](/reference/dockerfile/)

View File

@ -6,7 +6,7 @@ notoc: true
---
You can control the order of service startup and shutdown with the
[depends_on](compose-file/05-services.md#depends_on) attribute. Compose always starts and stops
[depends_on](/reference/compose-file/services.md#depends_on) attribute. Compose always starts and stops
containers in dependency order, where dependencies are determined by
`depends_on`, `links`, `volumes_from`, and `network_mode: "service:..."`.
@ -56,5 +56,5 @@ Compose also removes services in dependency order. `web` is removed before `db`
## Reference information
- [`depends_on`](compose-file/05-services.md#depends_on)
- [`healthcheck`](compose-file/05-services.md#healthcheck)
- [`depends_on`](/reference/compose-file/services.md#depends_on)
- [`healthcheck`](/reference/compose-file/services.md#healthcheck)

View File

@ -13,7 +13,7 @@ Environment variables are often available to all processes, and it can be diffic
## Use secrets
Getting a secret into a container is a two-step process. First, define the secret using the [top-level secrets element in your Compose file](compose-file/09-secrets.md). Next, update your service definitions to reference the secrets they require with the [secrets attribute](compose-file/05-services.md#secrets). Compose grants access to secrets on a per-service basis.
Getting a secret into a container is a two-step process. First, define the secret using the [top-level secrets element in your Compose file](/reference/compose-file/secrets.md). Next, update your service definitions to reference the secrets they require with the [secrets attribute](/reference/compose-file/services.md#secrets). Compose grants access to secrets on a per-service basis.
Unlike the other methods, this permits granular access control within a service container via standard filesystem permissions.
@ -103,6 +103,6 @@ secrets:
## Resources
- [Secrets top-level element](compose-file/09-secrets.md)
- [Secrets attribute for services top-level element](compose-file/05-services.md#secrets)
- [Secrets top-level element](/reference/compose-file/secrets.md)
- [Secrets attribute for services top-level element](/reference/compose-file/services.md#secrets)
- [Build secrets](https://docs.docker.com/build/building/secrets/)

View File

@ -9,7 +9,7 @@ computer, for example.
> Should I back up my containers?
>
> If you use volumes or bind-mounts to store your container data, backing up your containers may not be needed, but make sure to remember the options that were used when creating the container or use a [Docker Compose file](../compose/compose-file/index.md) if you want to re-create your containers with the same configuration after re-installation.
> If you use volumes or bind-mounts to store your container data, backing up your containers may not be needed, but make sure to remember the options that were used when creating the container or use a [Docker Compose file](/reference/compose-file/index.md) if you want to re-create your containers with the same configuration after re-installation.
## Save your data

View File

@ -44,9 +44,9 @@ Tests pass if the `sut` service returns `0`, and fail otherwise.
> [!NOTE]
>
> Only the `sut` service and all other services listed in
> [`depends_on`](../../compose/compose-file/05-services.md#depends_on) are
> [`depends_on`](/reference/compose-file/services.md#depends_on) are
> started. If you have services that poll for changes in other services, be sure
> to include the polling services in the [`depends_on`](../../compose/compose-file/05-services.md#depends_on)
> to include the polling services in the [`depends_on`](/reference/compose-file/services.md#depends_on)
> list to make sure all of your services start.
You can define more than one `docker-compose.test.yml` file if needed. Any file

View File

@ -415,9 +415,9 @@ volumes:
```
For more information about using volumes of the `bind` type with Compose, see
[Compose reference on volumes](/compose/compose-file/05-services.md#volumes).
[Compose reference on volumes](/reference/compose-file/services.md#volumes).
and
[Compose reference on volume configuration](/compose/compose-file/05-services.md#volumes).
[Compose reference on volume configuration](/reference/compose-file/services.md#volumes).
## Next steps

View File

@ -247,7 +247,7 @@ volumes:
```
For more information about using volumes with Compose, refer to the
[Volumes](/compose/compose-file/07-volumes.md)
[Volumes](/reference/compose-file/volumes.md)
section in the Compose specification.
### Start a service with volumes

View File

@ -133,7 +133,7 @@ Docker configs.
The `docker stack` command supports defining configs in a Compose file.
However, the `configs` key is not supported for `docker compose`. See
[the Compose file reference](../../compose/compose-file/legacy-versions.md) for details.
[the Compose file reference](/reference/compose-file/legacy-versions.md) for details.
### Simple example: Get started with configs

View File

@ -143,7 +143,7 @@ a similar way, see
Both the `docker-compose` and `docker stack` commands support defining secrets
in a compose file. See
[the Compose file reference](../../compose/compose-file/legacy-versions.md) for details.
[the Compose file reference](/reference/compose-file/legacy-versions.md) for details.
### Simple example: Get started with secrets
@ -1034,4 +1034,4 @@ Each service uses environment variables to specify where the service should look
for that secret data.
More information on short and long syntax for secrets can be found in the
[Compose Specification](../../compose/compose-file/09-secrets.md).
[Compose Specification](/reference/compose-file/secrets.md).

View File

@ -6,7 +6,7 @@ title: Deploy a stack to a swarm
When running Docker Engine in swarm mode, you can use `docker stack deploy` to
deploy a complete application stack to the swarm. The `deploy` command accepts
a stack description in the form of a [Compose file](../../compose/compose-file/legacy-versions.md).
a stack description in the form of a [Compose file](/reference/compose-file/legacy-versions.md).
{{< include "swarm-compose-compat.md" >}}

View File

@ -641,7 +641,7 @@ To run your containers with Docker Compose:
a service joins the default network and is both reachable by other
containers on that network, and discoverable by the service's name.
Therefore, in the `PMA_HOST` environment variable, you can specify the
service name, `db`, in order to connect to the database service. For more details about Compose, see the [Compose file reference](/compose/compose-file/).
service name, `db`, in order to connect to the database service. For more details about Compose, see the [Compose file reference](/reference/compose-file/).
2. Run Docker Compose.
1. Open a terminal and change directory to the directory where your
@ -673,6 +673,6 @@ Related information:
- [Docker Hub database images](https://hub.docker.com/search?q=database&type=image)
- [Dockerfile reference](/reference/dockerfile/)
- [Compose file reference](/compose/compose-file/)
- [Compose file reference](/reference/compose-file/)
- [CLI reference](/reference/cli/docker/)
- [Database samples](../../samples/_index.md#databases)

View File

@ -91,7 +91,7 @@ directory.
To learn more about the files that `docker init` added, see the following:
- [Dockerfile](../../../reference/dockerfile.md)
- [.dockerignore](../../../reference/dockerfile.md#dockerignore-file)
- [compose.yaml](../../../compose/compose-file/_index.md)
- [compose.yaml](/reference/compose-file/_index.md)
## Run the application

View File

@ -236,7 +236,7 @@ access all the services that your GenAI application needs.
Related information:
- [Dockerfile reference](../../../reference/dockerfile.md)
- [Compose file reference](../../../compose/compose-file/_index.md)
- [Compose file reference](/reference/compose-file/_index.md)
- [Ollama Docker image](https://hub.docker.com/r/ollama/ollama)
- [Neo4j Official Docker Image](https://hub.docker.com/_/neo4j)
- [GenAI Stack demo applications](https://github.com/docker/genai-stack)

View File

@ -308,7 +308,7 @@ volumes:
```
This Compose file specifies all the options you used in the `docker run` command. For more details about the Compose instructions, see the
[Compose file reference](../../../compose/compose-file/_index.md).
[Compose file reference](/reference/compose-file/_index.md).
Before you proceed, save your changes to the `compose.yaml` file.
@ -416,6 +416,6 @@ notebooks and environments with other data scientists.
Related information:
- [Dockerfile reference](/reference/dockerfile/)
- [Compose file reference](/compose/compose-file/)
- [Compose file reference](/reference/compose-file/)
- [Docker CLI reference](reference/cli/docker/)
- [Jupyter Docker Stacks docs](https://jupyter-docker-stacks.readthedocs.io/en/latest/)

View File

@ -456,7 +456,7 @@ same directory. It maps port 80 on the host to port 80 in the container. It also
has a `develop` subsection with the `watch` attribute that defines a list of
rules that control automatic service updates based on local file changes. For
more details about the Compose instructions, see the
[Compose file reference](../../compose/compose-file/_index.md).
[Compose file reference](/reference/compose-file/_index.md).
Save the changes to your `compose.yaml` file and then run the following command to run the application.
@ -535,6 +535,6 @@ Related information:
- [TensorFlow.js website](https://www.tensorflow.org/js)
- [MediaPipe website](https://developers.google.com/mediapipe/)
- [Dockerfile reference](/reference/dockerfile/)
- [Compose file reference](../../compose/compose-file/_index.md)
- [Compose file reference](/reference/compose-file/_index.md)
- [Docker CLI reference](/reference/cli/docker/)
- [Docker Blog: Accelerating Machine Learning with TensorFlow.js](https://www.docker.com/blog/accelerating-machine-learning-with-tensorflow-js-using-pretrained-models-and-docker/)

View File

@ -279,7 +279,7 @@ the way you define and share multi-service applications.
Related information:
- [Compose overview](../../compose/_index.md)
- [Compose file reference](../../compose/compose-file/_index.md)
- [Compose file reference](/reference/compose-file/_index.md)
- [Compose CLI reference](../../compose/reference/_index.md)
## Next steps

View File

@ -1,9 +1,9 @@
> [!NOTE]
>
> The `docker stack deploy` command uses the legacy
> [Compose file version 3](/compose/compose-file/compose-file-v3/)
> [Compose file version 3](/reference/compose-file/legacy-versions/)
> format, used by Compose V1. The latest format, defined by the
> [Compose specification](/compose/compose-file/)
> [Compose specification](/reference/compose-file/)
> isn't compatible with the `docker stack deploy` command.
>
> For more information about the evolution of Compose, see

View File

@ -36,7 +36,7 @@ directory.
To learn more about the files in the repository, see the following:
- [Dockerfile](../../reference/dockerfile.md)
- [.dockerignore](../../reference/dockerfile.md#dockerignore-file)
- [compose.yml](../../compose/compose-file/_index.md)
- [compose.yml](/reference/compose-file/_index.md)
## Run the application

View File

@ -62,7 +62,7 @@ Press `ctrl+c` in the terminal to stop your application.
In this section, you also learned how to use Compose Watch to automatically rebuild and run your container when you update your code.
Related information:
- [Compose file reference](/compose/compose-file/)
- [Compose file reference](/reference/compose-file/)
- [Compose file watch](../../compose/file-watch.md)
- [Multi-stage builds](../../build/building/multi-stage.md)

View File

@ -77,7 +77,7 @@ directory.
To learn more about the files that `docker init` added, see the following:
- [Dockerfile](../../reference/dockerfile.md)
- [.dockerignore](../../reference/dockerfile.md#dockerignore-file)
- [compose.yaml](../../compose/compose-file/_index.md)
- [compose.yaml](/reference/compose-file/_index.md)
## Run the application

View File

@ -119,7 +119,7 @@ secrets:
> [!NOTE]
>
> To learn more about the instructions in the Compose file, see [Compose file
> reference](/compose/compose-file/).
> reference](/reference/compose-file/).
Before you run the application using Compose, notice that this Compose file uses
`secrets` and specifies a `password.txt` file to hold the database's password.
@ -382,7 +382,7 @@ In this section, you took a look at setting up your Compose file to add a local
database and persist data. You also learned how to use Compose Watch to automatically rebuild and run your container when you update your code. And finally, you learned how to create a development container that contains the SDK tools and dependencies needed for development.
Related information:
- [Compose file reference](/compose/compose-file/)
- [Compose file reference](/reference/compose-file/)
- [Compose file watch](../../compose/file-watch.md)
- [Multi-stage builds](../../build/building/multi-stage.md)

View File

@ -593,12 +593,12 @@ You aren't going to cover any of these advanced use cases here.
### Variable substitution in Docker Compose
One of the really cool features of Docker Compose is [variable substitution](../../compose/compose-file/12-interpolation.md). You can see some examples in the Compose file, `environment` section. By means of an example:
One of the really cool features of Docker Compose is [variable substitution](/reference/compose-file/interpolation.md). You can see some examples in the Compose file, `environment` section. By means of an example:
* `PGUSER=${PGUSER:-totoro}` means that inside the container, the environment variable `PGUSER` shall be set to the same value as it has on the host machine where Docker Compose is run. If there is no environment variable with this name on the host machine, the variable inside the container gets the default value of `totoro`.
* `PGPASSWORD=${PGPASSWORD:?database password not set}` means that if the environment variable `PGPASSWORD` isn't set on the host, Docker Compose will display an error. This is OK, because you don't want to hard-code default values for the password. You set the password value in the `.env` file, which is local to your machine. It is always a good idea to add `.env` to `.gitignore` to prevent the secrets being checked into the version control.
Other ways of dealing with undefined or empty values exist, as documented in the [variable substitution](../../compose/compose-file/12-interpolation.md) section of the Docker documentation.
Other ways of dealing with undefined or empty values exist, as documented in the [variable substitution](/reference/compose-file/interpolation.md) section of the Docker documentation.
### Validating Docker Compose configuration
@ -722,7 +722,7 @@ Such distributed set-up offers interesting possibilities, such as applying Chaos
If you are interested in experimenting with CockroachDB clusters, check out:
* [Start a CockroachDB Cluster in Docker](https://www.cockroachlabs.com/docs/v20.2/start-a-local-cluster-in-docker-mac.html) article; and
* Documentation for Docker Compose keywords [`deploy`](../../compose/compose-file/legacy-versions.md) and [`replicas`](../../compose/compose-file/legacy-versions.md).
* Documentation for Docker Compose keywords [`deploy`](/reference/compose-file/legacy-versions.md) and [`replicas`](/reference/compose-file/legacy-versions.md).
### Other databases

View File

@ -279,7 +279,7 @@ directory.
- [Dockerfile](/reference/dockerfile/)
- [.dockerignore](/reference/dockerfile/#dockerignore-file)
- [docker-compose.yaml](../../compose/compose-file/_index.md)
- [docker-compose.yaml](/reference/compose-file/_index.md)
## Run the application

View File

@ -335,7 +335,7 @@ In this section, you took a look at running a database locally and persisting th
Related information:
- [Compose file reference](/compose/compose-file/)
- [Compose file reference](/reference/compose-file/)
- [Compose Watch](../../compose/file-watch.md)
- [Dockerfile reference](/reference/dockerfile/)

View File

@ -229,7 +229,7 @@ You should now have at least the following contents in your
To learn more about the files, see the following:
- [Dockerfile](../../reference/dockerfile.md)
- [.dockerignore](../../reference/dockerfile.md#dockerignore-file)
- [compose.yaml](../../compose/compose-file/_index.md)
- [compose.yaml](/reference/compose-file/_index.md)
## Run the application

View File

@ -86,7 +86,7 @@ You can use containers to set up local services, like a database. In this sectio
> [!NOTE]
>
> To learn more about the instructions in the Compose file, see [Compose file
> reference](/compose/compose-file/).
> reference](/reference/compose-file/).
3. Open `src/persistence/postgres.js` in an IDE or text editor. You'll notice
@ -417,8 +417,8 @@ database and persist data. You also learned how to create a multi-stage
Dockerfile and set up a bind mount for development.
Related information:
- [Volumes top-level element](/compose/compose-file/07-volumes/)
- [Services top-level element](/compose/compose-file/05-services/)
- [Volumes top-level element](/reference/compose-file/volumes/)
- [Services top-level element](/reference/compose-file/services/)
- [Multi-stage builds](../../build/building/multi-stage.md)
## Next steps

View File

@ -78,7 +78,7 @@ directory.
To learn more about the files that `docker init` added, see the following:
- [Dockerfile](../../reference/dockerfile.md)
- [.dockerignore](../../reference/dockerfile.md#dockerignore-file)
- [compose.yaml](../../compose/compose-file/_index.md)
- [compose.yaml](/reference/compose-file/_index.md)
## Run the application

View File

@ -111,7 +111,7 @@ secrets:
> [!NOTE]
>
> To learn more about the instructions in the Compose file, see [Compose file
> reference](/compose/compose-file/).
> reference](/reference/compose-file/).
Before you run the application using Compose, notice that this Compose file uses
`secrets` and specifies a `password.txt` file to hold the database's password.
@ -418,7 +418,7 @@ database and persist data. You also learned how to use Compose Watch to automati
Related information:
- [Build with Docker guide](../../build/guide/index.md)
- [Compose file reference](/compose/compose-file/)
- [Compose file reference](/reference/compose-file/)
- [Compose file watch](../../compose/file-watch.md)
- [Dockerfile reference](../../reference/dockerfile.md)
- [Official Docker Image for PHP](https://hub.docker.com/_/php)

View File

@ -318,7 +318,7 @@ To learn more about the files, see the following:
- [Dockerfile](../../reference/dockerfile.md)
- [.dockerignore](../../reference/dockerfile.md#dockerignore-file)
- [.gitignore](https://git-scm.com/docs/gitignore)
- [compose.yaml](../../compose/compose-file/_index.md)
- [compose.yaml](/reference/compose-file/_index.md)
## Run the application

View File

@ -380,7 +380,7 @@ secrets:
> [!NOTE]
>
> To learn more about the instructions in the Compose file, see [Compose file
> reference](/compose/compose-file/).
> reference](/reference/compose-file/).
Before you run the application using Compose, notice that this Compose file specifies a `password.txt` file to hold the database's password. You must create this file as it's not included in the source repository.
@ -557,7 +557,7 @@ In this section, you took a look at setting up your Compose file to add a local
database and persist data. You also learned how to use Compose Watch to automatically rebuild and run your container when you update your code.
Related information:
- [Compose file reference](/compose/compose-file/)
- [Compose file reference](/reference/compose-file/)
- [Compose file watch](../../compose/file-watch.md)
- [Multi-stage builds](../../build/building/multi-stage.md)

View File

@ -42,7 +42,7 @@ directory.
To learn more about the files in the repository, see the following:
- [Dockerfile](../../reference/dockerfile.md)
- [.dockerignore](../../reference/dockerfile.md#dockerignore-file)
- [compose.yaml](../../compose/compose-file/_index.md)
- [compose.yaml](/reference/compose-file/_index.md)
## Run the application

View File

@ -87,7 +87,7 @@ secrets:
> [!NOTE]
>
> To learn more about the instructions in the Compose file, see [Compose file
> reference](/compose/compose-file/).
> reference](/reference/compose-file/).
Before you run the application using Compose, notice that this Compose file specifies a `password.txt` file to hold the database's password. You must create this file as it's not included in the source repository.
@ -208,7 +208,7 @@ In this section, you took a look at setting up your Compose file to add a local
database and persist data. You also learned how to use Compose Watch to automatically rebuild and run your container when you update your code.
Related information:
- [Compose file reference](/compose/compose-file/)
- [Compose file reference](/reference/compose-file/)
- [Compose file watch](../../compose/file-watch.md)
- [Multi-stage builds](../../build/building/multi-stage.md)

View File

@ -341,7 +341,7 @@ directory.
To learn more about the files, see the following:
- [Dockerfile](../../reference/dockerfile.md)
- [.dockerignore](../../reference/dockerfile.md#dockerignore-file)
- [compose.yaml](../../compose/compose-file/_index.md)
- [compose.yaml](/reference/compose-file/_index.md)
## Run the application

View File

@ -54,7 +54,7 @@ secrets:
> [!NOTE]
>
> To learn more about the instructions in the Compose file, see [Compose file
> reference](/compose/compose-file/).
> reference](/reference/compose-file/).
Before you run the application using Compose, notice that this Compose file specifies a `password.txt` file to hold the database's password. You must create this file as it's not included in the source repository.
@ -188,7 +188,7 @@ In this section, you took a look at setting up your Compose file to add a local
database and persist data. You also learned how to use Compose Watch to automatically rebuild and run your container when you update your code.
Related information:
- [Compose file reference](/compose/compose-file/)
- [Compose file reference](/reference/compose-file/)
- [Compose file watch](../../compose/file-watch.md)
- [Multi-stage builds](../../build/building/multi-stage.md)

View File

@ -222,7 +222,7 @@ The following is the updated `compose.yaml` file.
```yaml {hl_lines=["17-23","30-55"]}
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Docker compose reference guide at
# https://docs.docker.com/compose/compose-file/
# https://docs.docker.com/reference/compose-file/
# Here the instructions define your application as a service called "server".
# This service is built from the Dockerfile in the current directory.

View File

@ -10,7 +10,7 @@ grid_files:
- title: Compose file
description: Defines a multi-container application.
icon: polyline
link: /compose/compose-file/
link: /reference/compose-file/
grid_clis:
- title: Docker CLI
description: The main Docker CLI, includes all `docker` commands.

View File

@ -11,37 +11,38 @@ grid:
- title: Version and name top-level element
description: Understand version and name attributes for Compose.
icon: feed
link: /compose/compose-file/04-version-and-name/
link: /reference/compose-file/version-and-name/
- title: Services top-level element
description: Explore all services attributes for Compose.
icon: construction
link: /compose/compose-file/05-services/
link: /reference/compose-file/services/
- title: Networks top-level element
description: Find all networks attributes for Compose.
icon: lan
link: /compose/compose-file/06-networks/
link: /reference/compose-file/networks/
- title: Volumes top-level element
description: Explore all volumes attributes for Compose.
icon: database
link: /compose/compose-file/07-volumes/
link: /reference/compose-file/volumes/
- title: Configs top-level element
description: Find out about configs in Compose.
icon: settings
link: /compose/compose-file/08-configs/
link: /reference/compose-file/configs/
- title: Secrets top-level element
description: Learn about secrets in Compose.
icon: lock
link: /compose/compose-file/09-secrets/
link: /reference/compose-file/secrets/
aliases:
- /compose/yaml/
- /compose/compose-file/compose-file-v1/
- /compose/yaml/
- /compose/compose-file/compose-file-v1/
- /compose/compose-file/
---
>**New to Docker Compose?**
>
> Find more information about the [key features and use cases of Docker Compose](../intro/features-uses.md) or [try the quickstart guide](../gettingstarted.md).
> Find more information about the [key features and use cases of Docker Compose](/compose/intro/features-uses.md) or [try the quickstart guide](/compose/gettingstarted.md).
The Compose Specification is the latest and recommended version of the Compose file format. It helps you define a [Compose file](../compose-application-model.md) which is used to configure your Docker applications services, networks, volumes, and more.
The Compose Specification is the latest and recommended version of the Compose file format. It helps you define a [Compose file](/compose/compose-application-model.md) which is used to configure your Docker applications services, networks, volumes, and more.
Legacy versions 2.x and 3.x of the Compose file format were merged into the Compose Specification. It is implemented in versions 1.27.0 and above (also known as Compose V2) of the Docker Compose CLI.

View File

@ -2,6 +2,8 @@
title: Compose Build Specification
description: Learn about the Compose Build Specification
keywords: compose, compose specification, compose file reference, compose build specification
aliases:
- /compose/compose-file/build/
---
{{< include "compose/build.md" >}}
@ -15,7 +17,7 @@ from the directory containing your Compose file. If it is absolute, the path pre
## Using `build` and `image`
When Compose is confronted with both a `build` subsection for a service and an `image` attribute, it follows the rules defined by the [`pull_policy`](05-services.md#pull_policy) attribute.
When Compose is confronted with both a `build` subsection for a service and an `image` attribute, it follows the rules defined by the [`pull_policy`](services.md#pull_policy) attribute.
If `pull_policy` is missing from the service definition, Compose attempts to pull the image first and then builds from source if the image isn't found in the registry or platform cache.
@ -80,7 +82,7 @@ Alternatively `build` can be an object with fields defined as follows:
### additional_contexts
{{< introduced compose 2.17.0 "../release-notes.md#2170" >}}
{{< introduced compose 2.17.0 "/compose/release-notes.md#2170" >}}
`additional_contexts` defines a list of named contexts the image builder should use during image build.
@ -226,7 +228,7 @@ build:
### dockerfile_inline
{{< introduced compose 2.17.0 "../release-notes.md#2170" >}}
{{< introduced compose 2.17.0 "/compose/release-notes.md#2170" >}}
`dockerfile_inline` defines the Dockerfile content as an inlined string in a Compose file. When set, the `dockerfile`
attribute is not allowed and Compose rejects any Compose file having both set.
@ -243,7 +245,7 @@ build:
### entitlements
{{< introduced compose 2.27.1 "../release-notes.md#2271" >}}
{{< introduced compose 2.27.1 "/compose/release-notes.md#2271" >}}
`entitlements` defines extra privileged entitlements to be allowed during the build.
@ -255,7 +257,7 @@ build:
### extra_hosts
`extra_hosts` adds hostname mappings at build-time. Use the same syntax as [extra_hosts](05-services.md#extra_hosts).
`extra_hosts` adds hostname mappings at build-time. Use the same syntax as [extra_hosts](services.md#extra_hosts).
```yml
extra_hosts:
@ -270,7 +272,7 @@ extra_hosts:
- "myhostv6=[::1]"
```
The separator `=` is preferred, but `:` can also be used. Introduced in Docker Compose version [2.24.1](../release-notes.md#2241). For example:
The separator `=` is preferred, but `:` can also be used. Introduced in Docker Compose version [2.24.1](/compose/release-notes.md#2241). For example:
```yml
extra_hosts:
@ -289,7 +291,7 @@ configuration, which means for Linux `/etc/hosts` will get extra lines:
### isolation
`isolation` specifies a builds container isolation technology. Like [isolation](05-services.md#isolation), supported values
`isolation` specifies a builds container isolation technology. Like [isolation](services.md#isolation), supported values
are platform specific.
### labels
@ -348,7 +350,7 @@ has been updated on registry (see [pull](#pull)).
### platforms
`platforms` defines a list of target [platforms](05-services.md#platform).
`platforms` defines a list of target [platforms](services.md#platform).
```yml
build:
@ -389,7 +391,7 @@ Composes reports an error in the following cases:
### privileged
{{< introduced compose 2.15.0 "../release-notes.md#2" >}}
{{< introduced compose 2.15.0 "/compose/release-notes.md#2" >}}
`privileged` configures the service image to build with elevated privileges. Support and actual impacts are platform specific.
@ -406,11 +408,11 @@ available in the local image store.
### secrets
`secrets` grants access to sensitive data defined by [secrets](05-services.md#secrets) on a per-service build basis. Two
`secrets` grants access to sensitive data defined by [secrets](services.md#secrets) on a per-service build basis. Two
different syntax variants are supported: the short syntax and the long syntax.
Compose reports an error if the secret isn't defined in the
[`secrets`](09-secrets.md) section of this Compose file.
[`secrets`](secrets.md) section of this Compose file.
#### Short syntax
@ -473,7 +475,7 @@ secrets:
Service builds may be granted access to multiple secrets. Long and short syntax for secrets may be used in the
same Compose file. Defining a secret in the top-level `secrets` must not imply granting any service build access to it.
Such grant must be explicit within service specification as [secrets](05-services.md#secrets) service element.
Such grant must be explicit within service specification as [secrets](services.md#secrets) service element.
### ssh
@ -511,7 +513,7 @@ For illustration, [BuildKit extended syntax](https://github.com/compose-spec/com
### shm_size
`shm_size` sets the size of the shared memory (`/dev/shm` partition on Linux) allocated for building Docker images. Specify
as an integer value representing the number of bytes or as a string expressing a [byte value](11-extension.md#specifying-byte-values).
as an integer value representing the number of bytes or as a string expressing a [byte value](extension.md#specifying-byte-values).
```yml
build:
@ -528,7 +530,7 @@ build:
### tags
`tags` defines a list of tag mappings that must be associated to the build image. This list comes in addition to
the `image` [property defined in the service section](05-services.md#image)
the `image` [property defined in the service section](services.md#image)
```yml
tags:
@ -548,7 +550,7 @@ build:
### ulimits
{{< introduced compose 2.23.1 "../release-notes.md#2231" >}}
{{< introduced compose 2.23.1 "/compose/release-notes.md#2231" >}}
`ulimits` overrides the default ulimits for a container. It's specified either as an integer for a single limit
or as mapping for soft/hard limits.

View File

@ -2,11 +2,13 @@
title: Configs top-level elements
description: Explore all the attributes the configs top-level element can have.
keywords: compose, compose specification, configs, compose file reference
aliases:
- /compose/compose-file/08-configs/
---
{{< include "compose/configs.md" >}}
Services can only access configs when explicitly granted by a [`configs`](05-services.md#configs) attribute within the `services` top-level element.
Services can only access configs when explicitly granted by a [`configs`](services.md#configs) attribute within the `services` top-level element.
By default, the config:
- Is owned by the user running the container command but can be overridden by service configuration.
@ -15,8 +17,8 @@ By default, the config:
The top-level `configs` declaration defines or references configuration data that is granted to services in your Compose application. The source of the config is either `file` or `external`.
- `file`: The config is created with the contents of the file at the specified path.
- `environment`: The config content is created with the value of an environment variable. Introduced in Docker Compose version [2.23.1](../release-notes.md#2231).
- `content`: The content is created with the inlined value. Introduced in Docker Compose version [2.23.1](../release-notes.md#2231).
- `environment`: The config content is created with the value of an environment variable. Introduced in Docker Compose version [2.23.1](/compose/release-notes.md#2231).
- `content`: The content is created with the inlined value. Introduced in Docker Compose version [2.23.1](/compose/release-notes.md#2231).
- `external`: If set to true, `external` specifies that this config has already been created. Compose does not
attempt to create it, and if it does not exist, an error occurs.
- `name`: The name of the config object in the container engine to look up. This field can be used to
@ -62,7 +64,7 @@ configs:
External configs lookup can also use a distinct key by specifying a `name`.
The following
example modifies the previous one to look up a config using the parameter `HTTP_CONFIG_KEY`. The actual lookup key is set at deployment time by the [interpolation](12-interpolation.md) of
example modifies the previous one to look up a config using the parameter `HTTP_CONFIG_KEY`. The actual lookup key is set at deployment time by the [interpolation](interpolation.md) of
variables, but exposed to containers as hard-coded ID `http_config`.
```yml

View File

@ -2,6 +2,8 @@
title: Compose Deploy Specification
description: Learn about the Compose Deploy Specification
keywords: compose, compose specification, compose file reference, compose deploy specification
aliases:
- /compose/compose-file/deploy/
---
{{< include "compose/deploy.md" >}}
@ -142,7 +144,7 @@ services:
#### memory
`memory` configures a limit or reservation on the amount of memory a container can allocate, set as a string expressing a [byte value](11-extension.md#specifying-byte-values).
`memory` configures a limit or reservation on the amount of memory a container can allocate, set as a string expressing a [byte value](extension.md#specifying-byte-values).
#### pids
@ -239,11 +241,11 @@ deploy:
- `none`, containers are not automatically restarted regardless of the exit status.
- `on-failure`, the container is restarted if it exits due to an error, which manifests as a non-zero exit code.
- `any` (default), containers are restarted regardless of the exit status.
- `delay`: How long to wait between restart attempts, specified as a [duration](11-extension.md#specifying-durations). The default is 0, meaning restart attempts can occur immediately.
- `delay`: How long to wait between restart attempts, specified as a [duration](extension.md#specifying-durations). The default is 0, meaning restart attempts can occur immediately.
- `max_attempts`: How many times to attempt to restart a container before giving up (default: never give up). If the restart does not
succeed within the configured `window`, this attempt doesn't count toward the configured `max_attempts` value.
For example, if `max_attempts` is set to '2', and the restart fails on the first attempt, more than two restarts must be attempted.
- `window`: How long to wait before deciding if a restart has succeeded, specified as a [duration](#specifying-durations) (default:
- `window`: How long to wait before deciding if a restart has succeeded, specified as a [duration](extension.md#specifying-durations) (default:
decide immediately).
```yml

View File

@ -2,6 +2,8 @@
title: Compose Develop Specification
description: Learn about the Compose Develop Specification
keywords: compose, compose specification, compose file reference, compose develop specification
aliases:
- /compose/compose-file/develop/
---
> **Note:**
@ -46,7 +48,7 @@ The `develop` subsection defines configuration options that are applied by Compo
### watch
The `watch` attribute defines a list of rules that control automatic service updates based on local file changes. `watch` is a sequence, each individual item in the sequence defines a rule to be applied by
Compose to monitor source code for changes. For more information, see [Use Compose Watch](../file-watch.md).
Compose to monitor source code for changes. For more information, see [Use Compose Watch](/compose/file-watch.md).
#### action

View File

@ -2,11 +2,13 @@
title: Extensions
description: Understand how to use extensions
keywords: compose, compose specification, extensions, compose file reference
aliases:
- /compose/compose-file/11-extension/
---
{{< include "compose/extension.md" >}}
Extensions can also be used with [anchors and aliases](10-fragments.md).
Extensions can also be used with [anchors and aliases](fragments.md).
They also can be used within any structure in a Compose file where user-defined keys are not expected.
Compose uses those to enable experimental features, the same way browsers add support for [custom CSS features](https://www.w3.org/TR/2011/REC-CSS2-20110607/syndata.html#vendor-keywords)

View File

@ -2,6 +2,8 @@
title: Fragments
description: Understand how to use fragments
keywords: compose, compose specification, fragments, compose file reference
aliases:
- /compose/compose-file/10-fragments/
---
{{< include "compose/fragments.md" >}}
@ -21,7 +23,7 @@ volumes:
In the example above, a `default-volume` anchor is created based on the `db-data` volume. It is later reused by the alias `*default-volume` to define the `metrics` volume.
Anchor resolution takes place before [variables interpolation](12-interpolation.md), so variables can't be used to set anchors or aliases.
Anchor resolution takes place before [variables interpolation](interpolation.md), so variables can't be used to set anchors or aliases.
## Example 2
@ -38,7 +40,7 @@ services:
environment: *env
```
If you have an anchor that you want to use in more than one service, use it in conjunction with an [extension](11-extension.md) to make your Compose file easier to maintain.
If you have an anchor that you want to use in more than one service, use it in conjunction with an [extension](extension.md) to make your Compose file easier to maintain.
## Example 3

View File

@ -2,9 +2,11 @@
title: Include
description: Learn about include
keywords: compose, compose specification, include, compose file reference
aliases:
- /compose/compose-file/14-include/
---
{{< introduced compose 2.20.0 "../release-notes.md#2200" >}}
{{< introduced compose 2.20.0 "/compose/release-notes.md#2200" >}}
A Compose application can declare dependency on another Compose application. This is useful if:
- You want to reuse other Compose files.
@ -34,7 +36,7 @@ services:
- serviceB #use serviceB directly as if it was declared in this Compose file
```
Compose also supports the use of interpolated variables with `include`. It's recommended that you [specify mandatory variables](12-interpolation.md). For example:
Compose also supports the use of interpolated variables with `include`. It's recommended that you [specify mandatory variables](interpolation.md). For example:
```text
include:
@ -79,7 +81,7 @@ include:
`path` is required and defines the location of the Compose file(s) to be parsed and included into the
local Compose model. `path` can be set to either a string when a single Compose file is involved,
or to a list of strings when multiple Compose files need to be [merged together](13-merge.md) to
or to a list of strings when multiple Compose files need to be [merged together](merge.md) to
define the Compose model to be included in the local application.
```yaml
@ -116,4 +118,4 @@ override values for customization.
## Additional resources
For more information on using `include`, see [Working with multiple Compose files](../multiple-compose-files/_index.md)
For more information on using `include`, see [Working with multiple Compose files](/compose/multiple-compose-files/_index.md)

View File

@ -2,6 +2,8 @@
title: Interpolation
description: Learn about interpolation
keywords: compose, compose specification, interpolation, compose file reference
aliases:
- /compose/compose-file/12-interpolation/
---
{{< include "compose/interpolation.md" >}}
@ -45,7 +47,7 @@ As any values in a Compose file can be interpolated with variable substitution,
for complex elements, interpolation is applied before a merge on a per-file basis.
Interpolation applies only to YAML values, not to keys. For the few places where keys are actually arbitrary
user-defined strings, such as [labels](05-services.md#labels) or [environment](05-services.md#environment), an alternate equal sign syntax
user-defined strings, such as [labels](services.md#labels) or [environment](services.md#environment), an alternate equal sign syntax
must be used for interpolation to apply. For example:
```yml

View File

@ -3,11 +3,12 @@ title: Legacy versions
description:
keywords: fig, composition, compose, versions, upgrading, docker, version 3, docker compose 3
aliases:
- /compose/compose-file/compose-versioning/
- /compose/compose-file/compose-file-v3/
- /compose/compose-file/compose-file-v2/
- /compose/compose-file/compose-versioning/
- /compose/compose-file/compose-file-v3/
- /compose/compose-file/compose-file-v2/
- /compose/compose-file/legacy-versions/
---
The legacy versions of the Compose file reference has moved to the [V1 branch of the Compose repository](https://github.com/docker/compose/tree/v1/docs). They are no longer being actively maintained.
The latest and recommended version of the Compose file format is defined by the [Compose Specification](_index.md). This format merges the 2.x and 3.x versions and is implemented by **Compose 1.27.0+**. For more information, see the[History and development of Docker Compose](../intro/history.md).
The latest and recommended version of the Compose file format is defined by the [Compose Specification](_index.md). This format merges the 2.x and 3.x versions and is implemented by **Compose 1.27.0+**. For more information, see the[History and development of Docker Compose](/compose/intro/history.md).

View File

@ -2,6 +2,8 @@
title: Merge
description: Learn about merging rules
keywords: compose, compose specification, merge, compose file reference
aliases:
- /compose/compose-file/13-merge/
---
{{< include "compose/merge.md" >}}
@ -72,7 +74,7 @@ services:
### Shell commands
When merging Compose files that use the services attributes [command](05-services.md#command), [entrypoint](05-services.md#entrypoint) and [healthcheck: `test`](05-services.md#healthcheck), the value is overridden by the latest Compose file, and not appended.
When merging Compose files that use the services attributes [command](services.md#command), [entrypoint](services.md#entrypoint) and [healthcheck: `test`](services.md#healthcheck), the value is overridden by the latest Compose file, and not appended.
Merging the following example YAML trees:
@ -98,7 +100,7 @@ services:
### Unique resources
Applies to the [ports](05-services.md#ports), [volumes](05-services.md#volumes), [secrets](05-services.md#secrets) and [configs](05-services.md#configs) services attributes.
Applies to the [ports](services.md#ports), [volumes](services.md#volumes), [secrets](services.md#secrets) and [configs](services.md#configs) services attributes.
While these types are modeled in a Compose file as a sequence, they have special uniqueness requirements:
| Attribute | Unique key |
@ -179,7 +181,7 @@ services:
### Replace value
{{< introduced compose 2.24.4 "../release-notes.md#2244" >}}
{{< introduced compose 2.24.4 "/compose/release-notes.md#2244" >}}
While `!reset` can be used to remove a declaration from a Compose file using an override file, `!override` allows you
to fully replace an attribute, bypassing the standard merge rules. A typical example is to fully replace a resource definition, to rely on a distinct model but using the same name.
@ -217,5 +219,5 @@ If `!override` had not been used, both `8080:80` and `8443:443` would be exposed
## Additional resources
For more information on how merge can be used to create a composite Compose file, see [Working with multiple Compose files](../multiple-compose-files/_index.md)
For more information on how merge can be used to create a composite Compose file, see [Working with multiple Compose files](/compose/multiple-compose-files/_index.md)

View File

@ -2,11 +2,13 @@
title: Networks top-level elements
description: Explore all the attributes the networks top-level element can have.
keywords: compose, compose specification, networks, compose file reference
aliases:
- /compose/compose-file/06-networks/
---
{{< include "compose/networks.md" >}}
To use a network across multiple services, you must explicitly grant each service access by using the [networks](05-services.md) attribute within the `services` top-level element. The `networks` top-level element has additional syntax that provides more granular control.
To use a network across multiple services, you must explicitly grant each service access by using the [networks](services.md) attribute within the `services` top-level element. The `networks` top-level element has additional syntax that provides more granular control.
## Examples
@ -217,4 +219,4 @@ networks:
## Additional resources
For more examples, see [Networking in Compose](../networking.md).
For more examples, see [Networking in Compose](/compose/networking.md).

View File

@ -2,11 +2,13 @@
title: Profiles
description: Learn about profiles
keywords: compose, compose specification, profiles, compose file reference
aliases:
- /compose/compose-file/15-profiles/
---
With profiles you can define a set of active profiles so your Compose application model is adjusted for various usages and environments.
The [services](05-services.md) top-level element supports a `profiles` attribute to define a list of named profiles.
The [services](services.md) top-level element supports a `profiles` attribute to define a list of named profiles.
Services without a `profiles` attribute are always enabled.
A service is ignored by Compose when none of the listed `profiles` match the active ones, unless the service is
@ -65,4 +67,4 @@ In the above example:
profile `debug` is automatically enabled and service `test_lib` is pulled in as a dependency starting both
services `debug_lib` and `test_lib`.
See how you can use `profiles` in [Docker Compose](../profiles.md).
See how you can use `profiles` in [Docker Compose](/compose/profiles.md).

View File

@ -2,11 +2,13 @@
title: Secrets top-level elements
description: Explore all the attributes the secrets top-level element can have.
keywords: compose, compose specification, secrets, compose file reference
aliases:
- /compose/compose-file/09-secrets/
---
Secrets are a flavor of [Configs](08-configs.md) focusing on sensitive data, with specific constraint for this usage.
Secrets are a flavor of [Configs](configs.md) focusing on sensitive data, with specific constraint for this usage.
Services can only access secrets when explicitly granted by a [`secrets` attribute](05-services.md#secrets) within the `services` top-level element.
Services can only access secrets when explicitly granted by a [`secrets` attribute](services.md#secrets) within the `services` top-level element.
The top-level `secrets` declaration defines or references sensitive data that is granted to the services in your Compose
application. The source of the secret is either `file` or `environment`.
@ -38,4 +40,4 @@ secrets:
## Additional resources
For more information, see [How to use secrets in Compose](../use-secrets.md).
For more information, see [How to use secrets in Compose](/compose/use-secrets.md).

View File

@ -2,6 +2,8 @@
title: Services top-level elements
description: Explore all the attributes the services top-level element can have.
keywords: compose, compose specification, services, compose file reference
aliases:
- /compose/compose-file/05-services/
---
{{< include "compose/services.md" >}}
@ -86,7 +88,7 @@ annotations:
### attach
{{< introduced compose 2.20.0 "../release-notes.md#2200" >}}
{{< introduced compose 2.20.0 "/compose/release-notes.md#2200" >}}
When `attach` is defined and set to `false` Compose does not collect service logs,
until you explicitly request it to.
@ -177,7 +179,7 @@ on Linux kernel.
### cpu_rt_runtime
`cpu_rt_runtime` configures CPU allocation parameters for platforms with support for realtime scheduler. It can be either
an integer value using microseconds as unit or a [duration](11-extension.md#specifying-durations).
an integer value using microseconds as unit or a [duration](extension.md#specifying-durations).
```yml
cpu_rt_runtime: '400ms'
@ -187,7 +189,7 @@ an integer value using microseconds as unit or a [duration](11-extension.md#spec
### cpu_rt_period
`cpu_rt_period` configures CPU allocation parameters for platforms with support for realtime scheduler. It can be either
an integer value using microseconds as unit or a [duration](11-extension.md#specifying-durations).
an integer value using microseconds as unit or a [duration](extension.md#specifying-durations).
```yml
cpu_rt_period: '1400us'
@ -228,7 +230,7 @@ cap_drop:
### cgroup
{{< introduced compose 2.15.0 "../release-notes.md#2150" >}}
{{< introduced compose 2.15.0 "/compose/release-notes.md#2150" >}}
`cgroup` specifies the cgroup namespace to join. When unset, it is the container runtime's decision to
select which cgroup namespace to use, if supported.
@ -269,7 +271,7 @@ Configs allow services to adapt their behaviour without the need to rebuild a Do
Services can only access configs when explicitly granted by the `configs` attribute. Two different syntax variants are supported.
Compose reports an error if `config` doesn't exist on the platform or isn't defined in the
[`configs` top-level element](08-configs.md) in the Compose file.
[`configs` top-level element](configs.md) in the Compose file.
There are two syntaxes defined for configs: a short syntax and a long syntax.
@ -436,7 +438,7 @@ expressed in the short form.
- `restart`: When set to `true` Compose restarts this service after it updates the dependency service.
This applies to an explicit restart controlled by a Compose operation, and excludes automated restart by the container runtime
after the container dies. Introduced in Docker Compose version [2.17.0](../release-notes.md#2170).
after the container dies. Introduced in Docker Compose version [2.17.0](/compose/release-notes.md#2170).
- `condition`: Sets the condition under which dependency is considered satisfied
- `service_started`: An equivalent of the short syntax described above
@ -446,7 +448,7 @@ expressed in the short form.
- `service_completed_successfully`: Specifies that a dependency is expected to run
to successful completion before starting a dependent service.
- `required`: When set to `false` Compose only warns you when the dependency service isn't started or available. If it's not defined
the default value of `required` is `true`. Introduced in Docker Compose version [2.20.0](../release-notes.md#2200).
the default value of `required` is `true`. Introduced in Docker Compose version [2.20.0](/compose/release-notes.md#2200).
Service dependencies cause the following behaviors:
@ -487,7 +489,7 @@ Compose guarantees dependency services marked with
### develop
{{< introduced compose 2.22.0 "../release-notes.md#2220" >}}
{{< introduced compose 2.22.0 "/compose/release-notes.md#2220" >}}
`develop` specifies the development configuration for maintaining a container in sync with source, as defined in the [Development Section](develop.md).
@ -558,7 +560,7 @@ dns_search:
### driver_opts
{{< introduced compose 2.27.1 "../release-notes.md#2271" >}}
{{< introduced compose 2.27.1 "/compose/release-notes.md#2271" >}}
`driver_opts` specifies a list of options as key-value pairs to pass to the driver. These options are
driver-dependent. Consult the driver's documentation for more information.
@ -648,7 +650,7 @@ Each line in an `.env` file must be in `VAR[=[VAL]]` format. The following synta
- Lines beginning with `#` are processed as comments and ignored.
- Blank lines are ignored.
- Unquoted and double-quoted (`"`) values have [Interpolation](12-interpolation.md) applied.
- Unquoted and double-quoted (`"`) values have [Interpolation](interpolation.md) applied.
- Each line represents a key-value pair. Values can optionally be quoted.
- `VAR=VAL` -> `VAL`
- `VAR="VAL"` -> `VAL`
@ -950,7 +952,7 @@ extra_hosts:
- "myhostv6=[::1]"
```
The separator `=` is preferred, but `:` can also be used. Introduced in Docker Compose version [2.24.1](../release-notes.md#2241). For example:
The separator `=` is preferred, but `:` can also be used. Introduced in Docker Compose version [2.24.1](/compose/release-notes.md#2241). For example:
```yml
extra_hosts:
@ -1001,7 +1003,7 @@ been the case if `group_add` were not declared.
{{< include "compose/services-healthcheck.md" >}}
For more information on `HEALTHCHECK`, see the [Dockerfile reference](../../reference/dockerfile.md#healthcheck).
For more information on `HEALTHCHECK`, see the [Dockerfile reference](/reference/dockerfile.md#healthcheck).
```yml
healthcheck:
@ -1013,7 +1015,7 @@ healthcheck:
start_interval: 5s
```
`interval`, `timeout`, `start_period`, and `start_interval` are [specified as durations](11-extension.md#specifying-durations). Introduced in Docker Compose version [2.20.2](../release-notes.md#2202)
`interval`, `timeout`, `start_period`, and `start_interval` are [specified as durations](extension.md#specifying-durations). Introduced in Docker Compose version [2.20.2](/compose/release-notes.md#2202)
`test` defines the command Compose runs to check container health. It can be
either a string or a list. If it's a list, the first item must be either `NONE`, `CMD` or `CMD-SHELL`.
@ -1178,13 +1180,13 @@ are platform specific. Driver specific options can be set with `options` as key-
### mem_limit
`mem_limit` configures a limit on the amount of memory a container can allocate, set as a string expressing a [byte value](11-extension.md#specifying-byte-values).
`mem_limit` configures a limit on the amount of memory a container can allocate, set as a string expressing a [byte value](extension.md#specifying-byte-values).
When set, `mem_limit` must be consistent with the `limits.memory` attribute in the [Deploy Specification](deploy.md#memory).
### mem_reservation
`mem_reservation` configures a reservation on the amount of memory a container can allocate, set as a string expressing a [byte value](11-extension.md#specifying-byte-values).
`mem_reservation` configures a reservation on the amount of memory a container can allocate, set as a string expressing a [byte value](extension.md#specifying-byte-values).
When set, `mem_reservation` must be consistent with the `reservations.memory` attribute in the [Deploy Specification](deploy.md#memory).
@ -1239,7 +1241,7 @@ services:
- some-network
- other-network
```
For more information about the `networks` top-level element, see [Networks](06-networks.md).
For more information about the `networks` top-level element, see [Networks](networks.md).
#### aliases
@ -1302,7 +1304,7 @@ networks:
Specify a static IP address for a service container when joining the network.
The corresponding network configuration in the [top-level networks section](06-networks.md) must have an
The corresponding network configuration in the [top-level networks section](networks.md) must have an
`ipam` attribute with subnet configurations covering each static address.
```yml
@ -1348,7 +1350,7 @@ networks:
#### mac_address
{{< introduced compose 2.23.2 "../release-notes.md#2232" >}}
{{< introduced compose 2.23.2 "/compose/release-notes.md#2232" >}}
`mac_address` sets the MAC address used by the service container when connecting to this particular network.
@ -1475,7 +1477,7 @@ expressed in the short form.
- `published`: The publicly exposed port. It is defined as a string and can be set as a range using syntax `start-end`. It means the actual port is assigned a remaining available port, within the set range.
- `host_ip`: The Host IP mapping, unspecified means all network interfaces (`0.0.0.0`).
- `protocol`: The port protocol (`tcp` or `udp`). Defaults to `tcp`.
- `app_protocol`: The application protocol (TCP/IP level 4 / OSI level 7) this port is used for. This is optional and can be used as a hint for Compose to offer richer behavior for protocols that it understands. Introduced in Docker Compose version [2.26.0](../release-notes.md#2260).
- `app_protocol`: The application protocol (TCP/IP level 4 / OSI level 7) this port is used for. This is optional and can be used as a hint for Compose to offer richer behavior for protocols that it understands. Introduced in Docker Compose version [2.26.0](/compose/release-notes.md#2260).
- `mode`: `host`: For publishing a host port on each node, or `ingress` for a port to be load balanced. Defaults to `ingress`.
- `name`: A human-readable name for the port, used to document it's usage within the service.
@ -1558,7 +1560,7 @@ Optionally, limit the number of restart retries the Docker daemon attempts.
```
You can find more detailed information on restart policies in the
[Restart Policies (--restart)](../../reference/cli/docker/container/run.md#restart)
[Restart Policies (--restart)](/reference/cli/docker/container/run.md#restart)
section of the Docker run reference page.
### runtime
@ -1588,10 +1590,10 @@ When both are set, `scale` must be consistent with the `replicas` attribute in t
Two different syntax variants are supported; the short syntax and the long syntax. Long and short syntax for secrets may be used in the same Compose file.
Compose reports an error if the secret doesn't exist on the platform or isn't defined in the
[`secrets` top-level section](09-secrets.md) of the Compose file.
[`secrets` top-level section](secrets.md) of the Compose file.
Defining a secret in the top-level `secrets` must not imply granting any service access to it.
Such grant must be explicit within service specification as [secrets](09-secrets.md) service element.
Such grant must be explicit within service specification as [secrets](secrets.md) service element.
#### Short syntax
@ -1660,17 +1662,17 @@ security_opt:
- label:role:ROLE
```
For further default labeling schemes you can override, see [Security configuration](../../reference/cli/docker/container/run.md#security-opt).
For further default labeling schemes you can override, see [Security configuration](/reference/cli/docker/container/run.md#security-opt).
### shm_size
`shm_size` configures the size of the shared memory (`/dev/shm` partition on Linux) allowed by the service container.
It's specified as a [byte value](11-extension.md#specifying-byte-values).
It's specified as a [byte value](extension.md#specifying-byte-values).
### stdin_open
`stdin_open` configures a service's container to run with an allocated stdin. This is the same as running a container with the
`-i` flag. For more information, see [Keep STDIN open](../../reference/cli/docker/container/run/#interactive).
`-i` flag. For more information, see [Keep STDIN open](/reference/cli/docker/container/run.md#interactive).
Supported values are `true` or `false`.
@ -1679,7 +1681,7 @@ Supported values are `true` or `false`.
`stop_grace_period` specifies how long Compose must wait when attempting to stop a container if it doesn't
handle SIGTERM (or whichever stop signal has been specified with
[`stop_signal`](#stop_signal)), before sending SIGKILL. It's specified
as a [duration](11-extension.md#specifying-durations).
as a [duration](extension.md#specifying-durations).
```yml
stop_grace_period: 1s
@ -1725,7 +1727,7 @@ sysctls:
You can only use sysctls that are namespaced in the kernel. Docker does not
support changing sysctls inside a container that also modify the host system.
For an overview of supported sysctls, refer to [configure namespaced kernel
parameters (sysctls) at runtime](../../reference/cli/docker/container/run.md#sysctl).
parameters (sysctls) at runtime](/reference/cli/docker/container/run.md#sysctl).
### tmpfs
@ -1744,7 +1746,7 @@ tmpfs:
### tty
`tty` configures a service's container to run with a TTY. This is the same as running a container with the
`-t` or `--tty` flag. For more information, see [Allocate a pseudo-TTY](../../reference/cli/docker/container/run/#tty).
`-t` or `--tty` flag. For more information, see [Allocate a pseudo-TTY](/reference/cli/docker/container/run.md#tty).
Supported values are `true` or `false`.
@ -1776,7 +1778,7 @@ userns_mode: "host"
### uts
{{< introduced compose 2.15.1 "../release-notes.md#2151" >}}
{{< introduced compose 2.15.1 "/compose/release-notes.md#2151" >}}
`uts` configures the UTS namespace mode set for the service container. When unspecified
it is the runtime's decision to assign a UTS namespace, if supported. Available values are:
@ -1813,7 +1815,7 @@ volumes:
db-data:
```
For more information about the `volumes` top-level element, see [Volumes](07-volumes.md).
For more information about the `volumes` top-level element, see [Volumes](volumes.md).
#### Short syntax
@ -1847,7 +1849,7 @@ expressed in the short form.
- `type`: The mount type. Either `volume`, `bind`, `tmpfs`, `npipe`, or `cluster`
- `source`: The source of the mount, a path on the host for a bind mount, or the
name of a volume defined in the
[top-level `volumes` key](07-volumes.md). Not applicable for a tmpfs mount.
[top-level `volumes` key](volumes.md). Not applicable for a tmpfs mount.
- `target`: The path in the container where the volume is mounted.
- `read_only`: Flag to set the volume as read-only.
- `bind`: Used to configure additional bind options:
@ -1861,13 +1863,13 @@ expressed in the short form.
- `subpath`: Path inside a volume to mount instead of the volume root.
- `tmpfs`: Configures additional tmpfs options:
- `size`: The size for the tmpfs mount in bytes (either numeric or as bytes unit).
- `mode`: The file mode for the tmpfs mount as Unix permission bits as an octal number. Introduced in Docker Compose version [2.14.0](../release-notes.md#2260).
- `mode`: The file mode for the tmpfs mount as Unix permission bits as an octal number. Introduced in Docker Compose version [2.14.0](/compose/release-notes.md#2260).
- `consistency`: The consistency requirements of the mount. Available values are platform specific.
> [!TIP]
>
> Working with large repositories or monorepos, or with virtual file systems that are no longer scaling with your codebase?
> Compose now takes advantage of [Synchronized file shares](../../desktop/synchronized-file-sharing.md) and automatically creates file shares for bind mounts.
> Compose now takes advantage of [Synchronized file shares](/desktop/synchronized-file-sharing.md) and automatically creates file shares for bind mounts.
> Ensure you're signed in to Docker with a paid subscription and have enabled both **Access experimental features** and **Manage Synchronized file shares with Compose** in Docker Desktop's settings.
### volumes_from

View File

@ -2,6 +2,8 @@
title: Version and name top-level elements
description: Understand when and if to set the version and name top-level element
keywords: compose, compose specification, services, compose file reference
aliases:
- /compose/compose-file/04-version-and-name/
---
## Version top-level element (obsolete)
@ -21,7 +23,7 @@ Compose offers a way for you to override this name, and sets a
default project name to be used if the top-level `name` element is not set.
Whenever a project name is defined by top-level `name` or by some custom mechanism, it is exposed for
[interpolation](12-interpolation.md) and environment variable resolution as `COMPOSE_PROJECT_NAME`
[interpolation](interpolation.md) and environment variable resolution as `COMPOSE_PROJECT_NAME`
```yml
name: myapp
@ -32,4 +34,4 @@ services:
command: echo "I'm running ${COMPOSE_PROJECT_NAME}"
```
For more information on other ways to name Compose projects, see [Specify a project name](../project-name.md).
For more information on other ways to name Compose projects, see [Specify a project name](/compose/project-name.md).

View File

@ -2,16 +2,18 @@
title: Volumes top-level element
description: Explore all the attributes the volumes top-level element can have.
keywords: compose, compose specification, volumes, compose file reference
aliases:
- /compose/compose-file/07-volumes/
---
{{< include "compose/volumes.md" >}}
To use a volume across multiple services, you must explicitly grant each service access by using the [volumes](05-services.md#volumes) attribute within the `services` top-level element. The `volumes` attribute has additional syntax that provides more granular control.
To use a volume across multiple services, you must explicitly grant each service access by using the [volumes](services.md#volumes) attribute within the `services` top-level element. The `volumes` attribute has additional syntax that provides more granular control.
> [!TIP]
>
> Working with large repositories or monorepos, or with virtual file systems that are no longer scaling with your codebase?
> Compose now takes advantage of [Synchronized file shares](../../desktop/synchronized-file-sharing.md) and automatically creates file shares for bind mounts.
> Compose now takes advantage of [Synchronized file shares](/desktop/synchronized-file-sharing.md) and automatically creates file shares for bind mounts.
> Ensure you're signed in to Docker with a paid subscription and have enabled both **Access experimental features** and **Manage Synchronized file shares with Compose** in Docker Desktop's settings.
## Example

View File

@ -245,7 +245,7 @@
- /go/dockerfile-aptget-best-practices/
"/build/building/context/#dockerignore-files":
- /go/build-context-dockerignore/
"/compose/compose-file":
"/reference/compose-file":
- /go/compose-spec-reference/
"/reference/dockerfile":
- /go/dockerfile-reference/

View File

@ -1037,39 +1037,39 @@ Reference:
section:
- sectiontitle: Compose Specification
section:
- path: /compose/compose-file/
- path: /reference/compose-file/
title: Overview
- path: /compose/compose-file/04-version-and-name/
- path: /reference/compose-file/version-and-name/
title: Version and name top-level element
- path: /compose/compose-file/05-services/
- path: /reference/compose-file/services/
title: Services top-level element
- path: /compose/compose-file/06-networks/
- path: /reference/compose-file/networks/
title: Network top-level element
- path: /compose/compose-file/07-volumes/
- path: /reference/compose-file/volumes/
title: Volumes top-level element
- path: /compose/compose-file/08-configs/
- path: /reference/compose-file/configs/
title: Configs top-level element
- path: /compose/compose-file/09-secrets/
- path: /reference/compose-file/secrets/
title: Secrets top-level element
- path: /compose/compose-file/10-fragments/
- path: /reference/compose-file/fragments/
title: Fragments
- path: /compose/compose-file/11-extension/
- path: /reference/compose-file/extension/
title: Extensions
- path: /compose/compose-file/12-interpolation/
- path: /reference/compose-file/interpolation/
title: Interpolation
- path: /compose/compose-file/13-merge/
- path: /reference/compose-file/merge/
title: Merge
- path: /compose/compose-file/14-include/
- path: /reference/compose-file/include/
title: Include
- path: /compose/compose-file/15-profiles/
- path: /reference/compose-file/profiles/
title: Profiles
- path: /compose/compose-file/build/
- path: /reference/compose-file/build/
title: Compose Build Specification
- path: /compose/compose-file/deploy/
- path: /reference/compose-file/deploy/
title: Compose Deploy Specification
- path: /compose/compose-file/develop/
- path: /reference/compose-file/develop/
title: Compose Develop Specification
- path: /compose/compose-file/legacy-versions/
- path: /reference/compose-file/legacy-versions/
title: Legacy versions
- path: /glossary/
title: Glossary