You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/reference/compose-file/networks.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -62,6 +62,40 @@ networks:
62
62
63
63
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.
64
64
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
Copy file name to clipboardExpand all lines: content/reference/compose-file/services.md
+38-4Lines changed: 38 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1321,6 +1321,28 @@ services:
1321
1321
```
1322
1322
For more information about the `networks` top-level element, see [Networks](networks.md).
1323
1323
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
+
1324
1346
#### `aliases`
1325
1347
1326
1348
`aliases`declares alternative hostnames for the service on the network. Other containers on the same
@@ -1675,13 +1697,23 @@ services:
1675
1697
1676
1698
`pull_policy` defines the decisions Compose makes when it starts to pull images. Possible values are:
1677
1699
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.
1680
1702
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.
1682
1704
This is the default option if you are not also using the [Compose Build Specification](build.md).
1683
1705
`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
+
```
1685
1717
1686
1718
### `read_only`
1687
1719
@@ -1779,6 +1811,8 @@ the service's containers.
1779
1811
The default value is world-readable permissions (mode `0444`).
1780
1812
The writable bit must be ignored if set. The executable bit may be set.
1781
1813
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
+
1782
1816
The following example sets the name of the `server-certificate` secret file to `server.cert`
1783
1817
within the container, sets the mode to `0440` (group-readable), and sets the user and group
1784
1818
to `103`. The value of `server-certificate` is set
0 commit comments