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
Use site parameter to use latest compose file versions in examples (docker#8630)
* Use site parameter to use latest compose file versions in examples
Make sure that examples use the latest version of the compose file
format, to encourage using the latest version, and to prevent
users from running into "not supported by this version" problems
when copy/pasting, and combining examples that use different
versions.
Also add a note about `version: x` not being equivalent to
`version: x.latest`.
Note that there are still some examples using fixed versions
in the UCP sections; we need to evaluate those to make sure
the right (and supported) versions are used for UCP (which may
be different than "latest").
Signed-off-by: Sebastiaan van Stijn <[email protected]>
* Address some v3/v2 issues, and YAML syntax error
Signed-off-by: Sebastiaan van Stijn <[email protected]>
* Minor edit
* Final updates
- Added note around v2 and v3 versioning
- Updated note for v3 to match the v2 update
Copy file name to clipboardExpand all lines: compose/compose-file/compose-file-v2.md
+18-18
Original file line number
Diff line number
Diff line change
@@ -50,7 +50,7 @@ definition in version 2.
50
50
51
51
A set of configuration options to set block IO limits for this service.
52
52
53
-
version: '2.2'
53
+
version: "{{ site.compose_file_v2 }}"
54
54
services:
55
55
foo:
56
56
image: busybox
@@ -393,7 +393,7 @@ Express dependency between services, which has two effects:
393
393
394
394
Simple example:
395
395
396
-
version: '2'
396
+
version: "{{ site.compose_file_v2 }}"
397
397
services:
398
398
web:
399
399
build: .
@@ -418,7 +418,7 @@ the healthcheck) before starting.
418
418
419
419
Example:
420
420
421
-
version: '2.1'
421
+
version: "{{ site.compose_file_v2 }}"
422
422
services:
423
423
web:
424
424
build: .
@@ -667,7 +667,7 @@ details.
667
667
A full example:
668
668
669
669
```
670
-
version: '2'
670
+
version: "{{ site.compose_file_v2 }}"
671
671
services:
672
672
myservice:
673
673
image: alpine
@@ -741,14 +741,14 @@ Run an init inside the container that forwards signals and reaps processes.
741
741
Either set a boolean value to use the default `init`, or specify a path to
742
742
a custom one.
743
743
744
-
version: '2.2'
744
+
version: "{{ site.compose_file_v2 }}"
745
745
services:
746
746
web:
747
747
image: alpine:latest
748
748
init: true
749
749
750
750
751
-
version: '2.2'
751
+
version: "{{ site.compose_file_v2 }}"
752
752
services:
753
753
web:
754
754
image: alpine:latest
@@ -885,7 +885,7 @@ The general format is shown here.
885
885
886
886
In the example below, three services are provided (`web`, `worker`, and `db`), along with two networks (`new` and `legacy`). The `db` service is reachable at the hostname `db` or `database` on the `new` network, and at `db` or `mysql` on the `legacy` network.
887
887
888
-
version: '2'
888
+
version: "{{ site.compose_file_v2 }}"
889
889
890
890
services:
891
891
web:
@@ -920,7 +920,7 @@ The corresponding network configuration in the [top-level networks section](#net
920
920
921
921
An example:
922
922
923
-
version: '2.1'
923
+
version: "{{ site.compose_file_v2 }}"
924
924
925
925
services:
926
926
app:
@@ -954,7 +954,7 @@ managed by docker (IPAM driver).
954
954
955
955
Example usage:
956
956
957
-
version: '2.1'
957
+
version: "{{ site.compose_file_v2 }}"
958
958
services:
959
959
app:
960
960
image: busybox
@@ -977,7 +977,7 @@ In the following example, the `app` service connects to `app_net_1` first
977
977
as it has the highest priority. It then connects to `app_net_3`, then
978
978
`app_net_2`, which uses the default priority value of `0`.
979
979
980
-
version: '2.3'
980
+
version: "{{ site.compose_file_v2 }}"
981
981
services:
982
982
app:
983
983
image: busybox
@@ -1216,7 +1216,7 @@ expressed in the short form.
1216
1216
1217
1217
1218
1218
```none
1219
-
version: "2.3"
1219
+
version: "{{ site.compose_file_v2 }}"
1220
1220
services:
1221
1221
web:
1222
1222
image: nginx:alpine
@@ -1380,7 +1380,7 @@ Here's an example of a two-service setup where a database's data directory is
1380
1380
shared with another service as a volume so that it can be periodically backed
1381
1381
up:
1382
1382
1383
-
version: "2.2"
1383
+
version: "{{ site.compose_file_v2 }}"
1384
1384
1385
1385
services:
1386
1386
db:
@@ -1433,7 +1433,7 @@ In the example below, instead of attempting to create a volume called
1433
1433
`[projectname]_data`, Compose looks for an existing volume simply
1434
1434
called `data` and mount it into the `db` service's containers.
1435
1435
1436
-
version: '2'
1436
+
version: "{{ site.compose_file_v2 }}"
1437
1437
1438
1438
services:
1439
1439
db:
@@ -1484,14 +1484,14 @@ conflicting with those used by other software.
1484
1484
1485
1485
Set a custom name for this volume.
1486
1486
1487
-
version: '2.1'
1487
+
version: "{{ site.compose_file_v2 }}"
1488
1488
volumes:
1489
1489
data:
1490
1490
name: my-app-data
1491
1491
1492
1492
It can also be used in conjunction with the `external` property:
1493
1493
1494
-
version: '2.1'
1494
+
version: "{{ site.compose_file_v2 }}"
1495
1495
volumes:
1496
1496
data:
1497
1497
external: true
@@ -1609,7 +1609,7 @@ attempting to create a network called `[projectname]_outside`, Compose
1609
1609
looks for an existing network simply called `outside` and connect the `proxy`
1610
1610
service's containers to it.
1611
1611
1612
-
version: '2'
1612
+
version: "{{ site.compose_file_v2 }}"
1613
1613
1614
1614
services:
1615
1615
proxy:
@@ -1644,14 +1644,14 @@ Not supported for version 2 `docker-compose` files. Use
1644
1644
1645
1645
Set a custom name for this network.
1646
1646
1647
-
version: '2.1'
1647
+
version: "{{ site.compose_file_v2 }}"
1648
1648
networks:
1649
1649
network1:
1650
1650
name: my-app-net
1651
1651
1652
1652
It can also be used in conjunction with the `external` property:
0 commit comments