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
`interface_name`lets you specify the name of the network interface used to connect a service to a given network. This ensures consistent and predictable interface naming across services and networks.
1408
+
1409
+
```yaml
1410
+
services:
1411
+
backend:
1412
+
image: alpine
1413
+
command: ip link show
1414
+
networks:
1415
+
back-tier:
1416
+
interface_name: eth0
1417
+
```
1418
+
1419
+
Running the example Compose application shows:
1420
+
1421
+
```console
1422
+
backend-1 | 11: eth0@if64: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
`provider`can be used to define a service that Compose won't manage directly. Compose delegated the service lifecycle to a dedicated or third-party component.
1723
+
1724
+
```yaml
1725
+
database:
1726
+
provider:
1727
+
type: awesomecloud
1728
+
options:
1729
+
type: mysql
1730
+
foo: bar
1731
+
app:
1732
+
image: myapp
1733
+
depends_on:
1734
+
- database
1735
+
```
1736
+
1737
+
As Compose runs the application, the `awesomecloud` binary is used to manage the `database` service setup.
1738
+
Dependent service `app` receives additional environment variables prefixed by the service name so it can access the resource.
1739
+
1740
+
For illustration, assuming `awesomecloud` execution produced variables `URL` and `API_KEY`, the `app` service
1741
+
runs with environment variables `DATABASE_URL` and `DATABASE_API_KEY`.
1742
+
1743
+
As Compose stops the application, the `awesomecloud` binary is used to manage the `database` service tear down.
1744
+
1745
+
The mechanism used by Compose to delegate the service lifecycle to an external binary is described [here](https://github.com/docker/compose/tree/main/docs/extension.md).
1746
+
1747
+
For more information on using the `provider` attribute, see [Use provider services](/manuals/compose/how-tos/provider-services.md).
1748
+
1749
+
### `type`
1750
+
1751
+
`type`attribute is required. It defines the external component used by Compose to manage setup and tear down lifecycle
1752
+
events.
1753
+
1754
+
### `options`
1755
+
1756
+
`options`are specific to the selected provider and not validated by the compose specification
1757
+
1696
1758
### `pull_policy`
1697
1759
1698
1760
`pull_policy` defines the decisions Compose makes when it starts to pull images. Possible values are:
@@ -2035,6 +2097,11 @@ The short syntax uses a single string with colon-separated values to specify a v
2035
2097
> platform it rejects Compose files which use relative host paths with an error. To avoid ambiguities
2036
2098
> with named volumes, relative paths should always begin with `.` or `..`.
2037
2099
2100
+
> [!NOTE]
2101
+
>
2102
+
> For bind mounts, the short syntax creates a directory at the source path on the host if it doesn't exist. This is for backward compatibility with `docker-compose` legacy.
2103
+
> It can be prevented by using long syntax and setting `create_host_path` to `false`.
2104
+
2038
2105
#### Long syntax
2039
2106
2040
2107
The long form syntax lets you configure additional fields that can't be
@@ -2048,9 +2115,7 @@ expressed in the short form.
2048
2115
- `read_only`: Flag to set the volume as read-only.
2049
2116
- `bind`: Used to configure additional bind options:
2050
2117
- `propagation`: The propagation mode used for the bind.
2051
-
- `create_host_path`: Creates a directory at the source path on host if there is nothing present.
2052
-
Compose does nothing if there is something present at the path. This is automatically implied by short syntax
2053
-
for backward compatibility with `docker-compose` legacy.
2118
+
- `create_host_path`: Creates a directory at the source path on host if there is nothing present. Defaults to `true`.
2054
2119
- `selinux`: The SELinux re-labeling option `z` (shared) or `Z` (private)
2055
2120
- `volume`: Configures additional volume options:
2056
2121
- `nocopy`: Flag to disable copying of data from a container when a volume is created.
0 commit comments