Merge pull request #22262 from aevesdocker/ENGDOCS-2489

ENGDOCS-2489
This commit is contained in:
Allie Sadler 2025-03-17 15:10:36 +00:00 committed by GitHub
parent 5516466e6c
commit 4b21fc22d1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 73 additions and 5 deletions

View File

@ -142,7 +142,7 @@ services:
In addition to the previously described mechanism, an override Compose file can also be used to remove elements from your application model. In addition to the previously described mechanism, an override Compose file can also be used to remove elements from your application model.
For this purpose, the custom [YAML tag](https://yaml.org/spec/1.2.2/#24-tags) `!reset` can be set to For this purpose, the custom [YAML tag](https://yaml.org/spec/1.2.2/#24-tags) `!reset` can be set to
override a value set by the overriden Compose file. A valid value for attribute must be provided, override a value set by the overridden Compose file. A valid value for attribute must be provided,
but will be ignored and target attribute will be set with type's default value or `null`. but will be ignored and target attribute will be set with type's default value or `null`.
For readability, it is recommended to explicitly set the attribute value to the null (`null`) or empty For readability, it is recommended to explicitly set the attribute value to the null (`null`) or empty

View File

@ -62,6 +62,40 @@ networks:
The advanced example shows a Compose file which defines two custom networks. The `proxy` service is isolated from the `db` service, because they do not share a network in common. Only `app` can talk to both. The advanced example shows a Compose file which defines two custom networks. The `proxy` service is isolated from the `db` service, because they do not share a network in common. Only `app` can talk to both.
## The default network
When a Compose file doesn't declare explicit networks, Compose uses an implicit `default` network. Services without an explicit [`networks`](services.md#networks) declaration are connected by Compose to this `default` network:
```yml
services:
some-service:
image: foo
```
This example is actually equivalent to:
```yml
services:
some-service:
image: foo
networks:
default: {}
networks:
default: {}
```
You can customize the `default` network with an explicit declaration:
```yml
networks:
default:
name: a_network # Use a custom name
driver_opts: # pass options to driver for network creation
com.docker.network.bridge.host_binding_ipv4: 127.0.0.1
```
For options, see the [Docker Engine docs](https://docs.docker.com/engine/network/drivers/bridge/#options).
## Attributes ## Attributes
### `driver` ### `driver`

View File

@ -1321,6 +1321,28 @@ services:
``` ```
For more information about the `networks` top-level element, see [Networks](networks.md). For more information about the `networks` top-level element, see [Networks](networks.md).
### Implicit default network
If `networks` is empty or absent from the Compose file, Compose considers an implicit definition for the service to be
connected to the `default` network:
```yml
services:
some-service:
image: foo
```
This example is actually equivalent to:
```yml
services:
some-service:
image: foo
networks:
default: {}
```
If you want the service to not be connected a network, you must set [`network_mode: none`](#network_mode).
#### `aliases` #### `aliases`
`aliases` declares alternative hostnames for the service on the network. Other containers on the same `aliases` declares alternative hostnames for the service on the network. Other containers on the same
@ -1675,13 +1697,23 @@ services:
`pull_policy` defines the decisions Compose makes when it starts to pull images. Possible values are: `pull_policy` defines the decisions Compose makes when it starts to pull images. Possible values are:
* `always`: Compose always pulls the image from the registry. - `always`: Compose always pulls the image from the registry.
* `never`: Compose doesn't pull the image from a registry and relies on the platform cached image. - `never`: Compose doesn't pull the image from a registry and relies on the platform cached image.
If there is no cached image, a failure is reported. If there is no cached image, a failure is reported.
* `missing`: Compose pulls the image only if it's not available in the platform cache. - `missing`: Compose pulls the image only if it's not available in the platform cache.
This is the default option if you are not also using the [Compose Build Specification](build.md). This is the default option if you are not also using the [Compose Build Specification](build.md).
`if_not_present` is considered an alias for this value for backward compatibility. `if_not_present` is considered an alias for this value for backward compatibility.
* `build`: Compose builds the image. Compose rebuilds the image if it's already present. - `build`: Compose builds the image. Compose rebuilds the image if it's already present.
- `daily`: Compose checks the registry for image updates if the last pull took place more than 24 hours ago.
- `weekly`: Compose checks the registry for image updates if the last pull took place more than 7 days ago.
- `every_<duration>`: Compose checks the registry for image updates if the last pull took place before `<duration>`. Duration can be expressed in weeks (`w`), days (`d`), hours (`h`), minutes (`m`), seconds (`s`) or a combination of these.
```yaml
services:
test:
image: nginx
pull_policy: every_12h
```
### `read_only` ### `read_only`
@ -1779,6 +1811,8 @@ the service's containers.
The default value is world-readable permissions (mode `0444`). The default value is world-readable permissions (mode `0444`).
The writable bit must be ignored if set. The executable bit may be set. The writable bit must be ignored if set. The executable bit may be set.
Note that support for `uid`, `gid`, and `mode` attributes are not implemented in Docker Compose when the source of the secret is a [`file`](secrets.md). This is because bind-mounts used under the hood don't allow uid remapping.
The following example sets the name of the `server-certificate` secret file to `server.cert` The following example sets the name of the `server-certificate` secret file to `server.cert`
within the container, sets the mode to `0440` (group-readable), and sets the user and group within the container, sets the mode to `0440` (group-readable), and sets the user and group
to `103`. The value of `server-certificate` is set to `103`. The value of `server-certificate` is set