Skip to content

Commit 4b21fc2

Browse files
authored
Merge pull request #22262 from aevesdocker/ENGDOCS-2489
ENGDOCS-2489
1 parent 5516466 commit 4b21fc2

File tree

3 files changed

+73
-5
lines changed

3 files changed

+73
-5
lines changed

content/reference/compose-file/merge.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ services:
142142

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

148148
For readability, it is recommended to explicitly set the attribute value to the null (`null`) or empty

content/reference/compose-file/networks.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,40 @@ networks:
6262
6363
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.
6464

65+
## The default network
66+
67+
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:
68+
69+
70+
```yml
71+
services:
72+
some-service:
73+
image: foo
74+
```
75+
This example is actually equivalent to:
76+
77+
```yml
78+
services:
79+
some-service:
80+
image: foo
81+
networks:
82+
default: {}
83+
networks:
84+
default: {}
85+
```
86+
87+
You can customize the `default` network with an explicit declaration:
88+
89+
```yml
90+
networks:
91+
default:
92+
name: a_network # Use a custom name
93+
driver_opts: # pass options to driver for network creation
94+
com.docker.network.bridge.host_binding_ipv4: 127.0.0.1
95+
```
96+
97+
For options, see the [Docker Engine docs](https://docs.docker.com/engine/network/drivers/bridge/#options).
98+
6599
## Attributes
66100

67101
### `driver`

content/reference/compose-file/services.md

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,28 @@ services:
13211321
```
13221322
For more information about the `networks` top-level element, see [Networks](networks.md).
13231323

1324+
### Implicit default network
1325+
1326+
If `networks` is empty or absent from the Compose file, Compose considers an implicit definition for the service to be
1327+
connected to the `default` network:
1328+
1329+
```yml
1330+
services:
1331+
some-service:
1332+
image: foo
1333+
```
1334+
This example is actually equivalent to:
1335+
1336+
```yml
1337+
services:
1338+
some-service:
1339+
image: foo
1340+
networks:
1341+
default: {}
1342+
```
1343+
1344+
If you want the service to not be connected a network, you must set [`network_mode: none`](#network_mode).
1345+
13241346
#### `aliases`
13251347

13261348
`aliases` declares alternative hostnames for the service on the network. Other containers on the same
@@ -1675,13 +1697,23 @@ services:
16751697

16761698
`pull_policy` defines the decisions Compose makes when it starts to pull images. Possible values are:
16771699

1678-
* `always`: Compose always pulls the image from the registry.
1679-
* `never`: Compose doesn't pull the image from a registry and relies on the platform cached image.
1700+
- `always`: Compose always pulls the image from the registry.
1701+
- `never`: Compose doesn't pull the image from a registry and relies on the platform cached image.
16801702
If there is no cached image, a failure is reported.
1681-
* `missing`: Compose pulls the image only if it's not available in the platform cache.
1703+
- `missing`: Compose pulls the image only if it's not available in the platform cache.
16821704
This is the default option if you are not also using the [Compose Build Specification](build.md).
16831705
`if_not_present` is considered an alias for this value for backward compatibility.
1684-
* `build`: Compose builds the image. Compose rebuilds the image if it's already present.
1706+
- `build`: Compose builds the image. Compose rebuilds the image if it's already present.
1707+
- `daily`: Compose checks the registry for image updates if the last pull took place more than 24 hours ago.
1708+
- `weekly`: Compose checks the registry for image updates if the last pull took place more than 7 days ago.
1709+
- `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.
1710+
1711+
```yaml
1712+
services:
1713+
test:
1714+
image: nginx
1715+
pull_policy: every_12h
1716+
```
16851717

16861718
### `read_only`
16871719

@@ -1779,6 +1811,8 @@ the service's containers.
17791811
The default value is world-readable permissions (mode `0444`).
17801812
The writable bit must be ignored if set. The executable bit may be set.
17811813

1814+
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.
1815+
17821816
The following example sets the name of the `server-certificate` secret file to `server.cert`
17831817
within the container, sets the mode to `0440` (group-readable), and sets the user and group
17841818
to `103`. The value of `server-certificate` is set

0 commit comments

Comments
 (0)