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
Stick with the preferred version of compose files according to
https://docs.docker.com/compose/intro/compose-application-model/#the-compose-file
<!--Delete sections as needed -->
## Description
<!-- Tell us what you did and why -->
## Related issues or tickets
<!-- Related issues, pull requests, or Jira tickets -->
## Reviews
<!-- Notes for reviewers here -->
<!-- List applicable reviews (optionally @tag reviewers) -->
- [ ] Technical review
- [ ] Editorial review
- [ ] Product review
Copy file name to clipboardExpand all lines: content/manuals/compose/how-tos/multiple-compose-files/merge.md
+14-14Lines changed: 14 additions & 14 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,8 +10,8 @@ aliases:
10
10
11
11
Docker Compose lets you merge and override a set of Compose files together to create a composite Compose file.
12
12
13
-
By default, Compose reads two files, a `compose.yml` and an optional
14
-
`compose.override.yml` file. By convention, the `compose.yml`
13
+
By default, Compose reads two files, a `compose.yaml` and an optional
14
+
`compose.override.yaml` file. By convention, the `compose.yaml`
15
15
contains your base configuration. The override file can
16
16
contain configuration overrides for existing services or entirely new
17
17
services.
@@ -32,10 +32,10 @@ add to their predecessors.
32
32
For example:
33
33
34
34
```console
35
-
$ docker compose -f compose.yml -f compose.admin.yml run backup_db
35
+
$ docker compose -f compose.yaml -f compose.admin.yaml run backup_db
36
36
```
37
37
38
-
The `compose.yml` file might specify a `webapp` service.
38
+
The `compose.yaml` file might specify a `webapp` service.
39
39
40
40
```yaml
41
41
webapp:
@@ -46,7 +46,7 @@ webapp:
46
46
- "/data"
47
47
```
48
48
49
-
The `compose.admin.yml` may also specify this same service:
49
+
The `compose.admin.yaml` may also specify this same service:
50
50
51
51
```yaml
52
52
webapp:
@@ -226,7 +226,7 @@ For more merging rules, see [Merge and override](/reference/compose-file/merge.m
226
226
227
227
### Additional information
228
228
229
-
- Using `-f` is optional. If not provided, Compose searches the working directory and its parent directories for a `compose.yml` and a `compose.override.yml` file. You must supply at least the `compose.yml` file. If both files exist on the same directory level, Compose combines them into a single configuration.
229
+
- Using `-f` is optional. If not provided, Compose searches the working directory and its parent directories for a `compose.yaml` and a `compose.override.yaml` file. You must supply at least the `compose.yaml` file. If both files exist on the same directory level, Compose combines them into a single configuration.
230
230
231
231
- You can use a `-f` with `-` (dash) as the filename to read the configuration from `stdin`. For example:
232
232
```console
@@ -246,12 +246,12 @@ For more merging rules, see [Merge and override](/reference/compose-file/merge.m
246
246
247
247
- You can use the `-f` flag to specify a path to a Compose file that is not located in the current directory, either from the command line or by setting up a [COMPOSE_FILE environment variable](../environment-variables/envvars.md#compose_file) in your shell or in an environment file.
248
248
249
-
For example, if you are running the [Compose Rails sample](https://github.com/docker/awesome-compose/tree/master/official-documentation-samples/rails/README.md), and have a `compose.yml` file in a directory called `sandbox/rails`. You can use a command like [docker compose pull](/reference/cli/docker/compose/pull.md) to get the postgres image for the `db` service from anywhere by using the `-f` flag as follows: `docker compose -f ~/sandbox/rails/compose.yml pull db`
249
+
For example, if you are running the [Compose Rails sample](https://github.com/docker/awesome-compose/tree/master/official-documentation-samples/rails/README.md), and have a `compose.yaml` file in a directory called `sandbox/rails`. You can use a command like [docker compose pull](/reference/cli/docker/compose/pull.md) to get the postgres image for the `db` service from anywhere by using the `-f` flag as follows: `docker compose -f ~/sandbox/rails/compose.yaml pull db`
250
250
251
251
Here's the full example:
252
252
253
253
```console
254
-
$ docker compose -f ~/sandbox/rails/compose.yml pull db
254
+
$ docker compose -f ~/sandbox/rails/compose.yaml pull db
255
255
Pulling db (postgres:latest)...
256
256
latest: Pulling from library/postgres
257
257
ef0380f84d05: Pull complete
@@ -281,7 +281,7 @@ a few different files:
281
281
Start with a base file that defines the canonical configuration for the
282
282
services.
283
283
284
-
`compose.yml`
284
+
`compose.yaml`
285
285
286
286
```yaml
287
287
services:
@@ -301,7 +301,7 @@ services:
301
301
In this example the development configuration exposes some ports to the
302
302
host, mounts our code as a volume, and builds the web image.
303
303
304
-
`compose.override.yml`
304
+
`compose.override.yaml`
305
305
306
306
```yaml
307
307
services:
@@ -329,7 +329,7 @@ When you run `docker compose up` it reads the overrides automatically.
329
329
To use this Compose app in a production environment, another override file is created, which might be stored in a different git
330
330
repository or managed by a different team.
331
331
332
-
`compose.prod.yml`
332
+
`compose.prod.yaml`
333
333
334
334
```yaml
335
335
services:
@@ -347,12 +347,12 @@ services:
347
347
To deploy with this production Compose file you can run
348
348
349
349
```console
350
-
$ docker compose -f compose.yml -f compose.prod.yml up -d
350
+
$ docker compose -f compose.yaml -f compose.prod.yaml up -d
351
351
```
352
352
353
353
This deploys all three services using the configuration in
354
-
`compose.yml`and `compose.prod.yml` but not the
355
-
dev configuration in `compose.override.yml`.
354
+
`compose.yaml`and `compose.prod.yaml` but not the
355
+
dev configuration in `compose.override.yaml`.
356
356
357
357
For more information, see [Using Compose in production](../production.md).
0 commit comments