Skip to content

Commit d6cbbda

Browse files
ArthurFlagsarahsanders-docker
authored andcommitted
fix: code block (docker#23022)
1 parent 8994ee5 commit d6cbbda

File tree

1 file changed

+32
-30
lines changed

1 file changed

+32
-30
lines changed

content/reference/compose-file/services.md

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ services:
4343
POSTGRES_DB: exampledb
4444
```
4545
46-
### Advanced example
46+
### Advanced example
4747
48-
In the following example, the `proxy` service uses the Nginx image, mounts a local Nginx configuration file into the container, exposes port `80` and depends on the `backend` service.
48+
In the following example, the `proxy` service uses the Nginx image, mounts a local Nginx configuration file into the container, exposes port `80` and depends on the `backend` service.
4949

5050
The `backend` service builds an image from the Dockerfile located in the `backend` directory that is set to build at stage `builder`.
5151

@@ -376,7 +376,9 @@ credential_spec:
376376
When using `registry:`, the credential spec is read from the Windows registry on
377377
the daemon's host. A registry value with the given name must be located in:
378378

379-
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs
379+
```bash
380+
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Virtualization\Containers\CredentialSpecs
381+
```
380382

381383
The following example loads the credential spec from a value named `my-credential-spec`
382384
in the registry:
@@ -668,7 +670,7 @@ env_file:
668670

669671
The `format` attribute lets you use an alternative file format for the `env_file`. When not set, `env_file` is parsed according to the Compose rules outlined in [`Env_file` format](#env_file-format).
670672

671-
`raw` format lets you use an `env_file` with key=value items, but without any attempt from Compose to parse the value for interpolation.
673+
`raw` format lets you use an `env_file` with key=value items, but without any attempt from Compose to parse the value for interpolation.
672674
This let you pass values as-is, including quotes and `$` signs.
673675

674676
```yml
@@ -760,7 +762,7 @@ expose:
760762

761763
> [!NOTE]
762764
>
763-
> If the Dockerfile for the image already exposes ports, it is visible to other containers on the network even if `expose` is not set in your Compose file.
765+
> If the Dockerfile for the image already exposes ports, it is visible to other containers on the network even if `expose` is not set in your Compose file.
764766

765767
### `extends`
766768

@@ -778,7 +780,7 @@ extends:
778780
- `service`: Defines the name of the service being referenced as a base, for example `web` or `database`.
779781
- `file`: The location of a Compose configuration file defining that service.
780782

781-
#### Restrictions
783+
#### Restrictions
782784

783785
When a service is referenced using `extends`, it can declare dependencies on other resources. These dependencies may be explicitly defined through attributes like `volumes`, `networks`, `configs`, `secrets`, `links`, `volumes_from`, or `depends_on`. Alternatively, dependencies can reference another service using the `service:{name}` syntax in namespace declarations such as `ipc`, `pid`, or `network_mode`.
784786

@@ -1022,7 +1024,7 @@ an implicit `gpu` capability.
10221024
```yaml
10231025
services:
10241026
model:
1025-
gpus:
1027+
gpus:
10261028
- driver: 3dfx
10271029
count: 2
10281030
```
@@ -1325,12 +1327,12 @@ If either is omitted, Compose automatically generates the environment variable n
13251327

13261328
### `network_mode`
13271329

1328-
`network_mode` sets a service container's network mode.
1330+
`network_mode` sets a service container's network mode.
13291331

13301332
- `none`: Turns off all container networking.
13311333
- `host`: Gives the container raw access to the host's network interface.
1332-
- `service:{name}`: Gives the container access to the specified container by referring to its service name.
1333-
- `container:{name}`: Gives the container access to the specified container by referring to its container ID.
1334+
- `service:{name}`: Gives the container access to the specified container by referring to its service name.
1335+
- `container:{name}`: Gives the container access to the specified container by referring to its container ID.
13341336

13351337
For more information container networks, see the [Docker Engine documentation](/manuals/engine/network/_index.md#container-networks).
13361338

@@ -1359,7 +1361,7 @@ For more information about the `networks` top-level element, see [Networks](netw
13591361
### Implicit default network
13601362

13611363
If `networks` is empty or absent from the Compose file, Compose considers an implicit definition for the service to be
1362-
connected to the `default` network:
1364+
connected to the `default` network:
13631365

13641366
```yml
13651367
services:
@@ -1371,9 +1373,9 @@ This example is actually equivalent to:
13711373
```yml
13721374
services:
13731375
some-service:
1374-
image: foo
1376+
image: foo
13751377
networks:
1376-
default: {}
1378+
default: {}
13771379
```
13781380

13791381
If you want the service to not be connected a network, you must set [`network_mode: none`](#network_mode).
@@ -1454,7 +1456,7 @@ services:
14541456
Running the example Compose application shows:
14551457

14561458
```console
1457-
backend-1 | 11: eth0@if64: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
1459+
backend-1 | 11: eth0@if64: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1500 qdisc noqueue state UP
14581460
```
14591461

14601462
#### `ipv4_address`, `ipv6_address`
@@ -1625,11 +1627,11 @@ in the form:
16251627

16261628
`[HOST:]CONTAINER[/PROTOCOL]` where:
16271629

1628-
- `HOST` is `[IP:](port | range)` (optional). If it is not set, it binds to all network interfaces (`0.0.0.0`).
1630+
- `HOST` is `[IP:](port | range)` (optional). If it is not set, it binds to all network interfaces (`0.0.0.0`).
16291631
- `CONTAINER` is `port | range`.
16301632
- `PROTOCOL` restricts ports to a specified protocol either `tcp` or `udp`(optional). Default is `tcp`.
16311633

1632-
Ports can be either a single value or a range. `HOST` and `CONTAINER` must use equivalent ranges.
1634+
Ports can be either a single value or a range. `HOST` and `CONTAINER` must use equivalent ranges.
16331635

16341636
You can either specify both ports (`HOST:CONTAINER`), or just the container port. In the latter case,
16351637
the container runtime automatically allocates any unassigned port of the host.
@@ -1650,10 +1652,10 @@ ports:
16501652
- "49100:22"
16511653
- "8000-9000:80"
16521654
- "127.0.0.1:8001:8001"
1653-
- "127.0.0.1:5000-5010:5000-5010"
1654-
- "::1:6000:6000"
1655-
- "[::1]:6001:6001"
1656-
- "6060:6060/udp"
1655+
- "127.0.0.1:5000-5010:5000-5010"
1656+
- "::1:6000:6000"
1657+
- "[::1]:6001:6001"
1658+
- "6060:6060/udp"
16571659
```
16581660

16591661
> [!NOTE]
@@ -1762,15 +1764,15 @@ services:
17621764
type: awesomecloud
17631765
options:
17641766
type: mysql
1765-
foo: bar
1767+
foo: bar
17661768
app:
1767-
image: myapp
1769+
image: myapp
17681770
depends_on:
17691771
- database
17701772
```
17711773

1772-
As Compose runs the application, the `awesomecloud` binary is used to manage the `database` service setup.
1773-
Dependent service `app` receives additional environment variables prefixed by the service name so it can access the resource.
1774+
As Compose runs the application, the `awesomecloud` binary is used to manage the `database` service setup.
1775+
Dependent service `app` receives additional environment variables prefixed by the service name so it can access the resource.
17741776

17751777
For illustration, assuming `awesomecloud` execution produced variables `URL` and `API_KEY`, the `app` service
17761778
runs with environment variables `DATABASE_URL` and `DATABASE_API_KEY`.
@@ -1906,7 +1908,7 @@ the service's containers.
19061908
- `mode`: The [permissions](https://wintelguy.com/permissions-calc.pl) for the file to be mounted in `/run/secrets/`
19071909
in the service's task containers, in octal notation.
19081910
The default value is world-readable permissions (mode `0444`).
1909-
The writable bit must be ignored if set. The executable bit may be set.
1911+
The writable bit must be ignored if set. The executable bit may be set.
19101912

19111913
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.
19121914

@@ -1949,7 +1951,7 @@ It's specified as a [byte value](extension.md#specifying-byte-values).
19491951

19501952
### `stdin_open`
19511953

1952-
`stdin_open` configures a service's container to run with an allocated stdin. This is the same as running a container with the
1954+
`stdin_open` configures a service's container to run with an allocated stdin. This is the same as running a container with the
19531955
`-i` flag. For more information, see [Keep stdin open](/reference/cli/docker/container/run.md#interactive).
19541956

19551957
Supported values are `true` or `false`.
@@ -2036,7 +2038,7 @@ services:
20362038

20372039
### `tty`
20382040

2039-
`tty` configures a service's container to run with a TTY. This is the same as running a container with the
2041+
`tty` configures a service's container to run with a TTY. This is the same as running a container with the
20402042
`-t` or `--tty` flag. For more information, see [Allocate a pseudo-TTY](/reference/cli/docker/container/run.md#tty).
20412043

20422044
Supported values are `true` or `false`.
@@ -2140,7 +2142,7 @@ The short syntax uses a single string with colon-separated values to specify a v
21402142

21412143
> [!NOTE]
21422144
>
2143-
> 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.
2145+
> 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.
21442146
> It can be prevented by using long syntax and setting `create_host_path` to `false`.
21452147

21462148
#### Long syntax
@@ -2170,8 +2172,8 @@ expressed in the short form.
21702172

21712173
> [!TIP]
21722174
>
2173-
> Working with large repositories or monorepos, or with virtual file systems that are no longer scaling with your codebase?
2174-
> Compose now takes advantage of [Synchronized file shares](/manuals/desktop/features/synchronized-file-sharing.md) and automatically creates file shares for bind mounts.
2175+
> Working with large repositories or monorepos, or with virtual file systems that are no longer scaling with your codebase?
2176+
> Compose now takes advantage of [Synchronized file shares](/manuals/desktop/features/synchronized-file-sharing.md) and automatically creates file shares for bind mounts.
21752177
> 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.
21762178

21772179
### `volumes_from`

0 commit comments

Comments
 (0)