mirror of https://github.com/docker/docs.git
updated include file to use code fences (#5229)
Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
This commit is contained in:
parent
d2091304ee
commit
dfe6ee6cd1
|
@ -2,28 +2,33 @@ It is possible to re-use configuration fragments using extension fields. Those
|
||||||
special fields can be of any format as long as they are located at the root of
|
special fields can be of any format as long as they are located at the root of
|
||||||
your Compose file and their name start with the `x-` character sequence.
|
your Compose file and their name start with the `x-` character sequence.
|
||||||
|
|
||||||
version: '2.1'
|
```none
|
||||||
x-custom:
|
version: '2.1'
|
||||||
items:
|
x-custom:
|
||||||
- a
|
items:
|
||||||
- b
|
- a
|
||||||
options:
|
- b
|
||||||
max-size: '12m'
|
options:
|
||||||
name: "custom"
|
max-size: '12m'
|
||||||
|
name: "custom"
|
||||||
|
```
|
||||||
|
|
||||||
The contents of those fields will be ignored by Compose, but they can be
|
The contents of those fields will be ignored by Compose, but they can be
|
||||||
inserted in your resource definitions using [YAML anchors](http://www.yaml.org/spec/1.2/spec.html#id2765878).
|
inserted in your resource definitions using [YAML anchors](http://www.yaml.org/spec/1.2/spec.html#id2765878).
|
||||||
For example, if you want several of your services to use the same logging
|
For example, if you want several of your services to use the same logging
|
||||||
configuration:
|
configuration:
|
||||||
|
|
||||||
logging:
|
```none
|
||||||
options:
|
logging:
|
||||||
max-size: '12m'
|
options:
|
||||||
max-file: 5
|
max-size: '12m'
|
||||||
driver: json-file
|
max-file: 5
|
||||||
|
driver: json-file
|
||||||
|
```
|
||||||
|
|
||||||
You may write your Compose file as follows:
|
You may write your Compose file as follows:
|
||||||
|
|
||||||
|
```none
|
||||||
version: '2.1'
|
version: '2.1'
|
||||||
x-logging:
|
x-logging:
|
||||||
&default-logging
|
&default-logging
|
||||||
|
@ -39,25 +44,28 @@ services:
|
||||||
db:
|
db:
|
||||||
image: mysql:latest
|
image: mysql:latest
|
||||||
logging: *default-logging
|
logging: *default-logging
|
||||||
|
```
|
||||||
|
|
||||||
It is also possible to partially override values in extension fields using
|
It is also possible to partially override values in extension fields using
|
||||||
the [YAML merge type](http://yaml.org/type/merge.html). For example:
|
the [YAML merge type](http://yaml.org/type/merge.html). For example:
|
||||||
|
|
||||||
version: '2.1'
|
```none
|
||||||
x-volumes:
|
version: '2.1'
|
||||||
&default-volume
|
x-volumes:
|
||||||
driver: foobar-storage
|
&default-volume
|
||||||
|
driver: foobar-storage
|
||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
image: myapp/web:latest
|
image: myapp/web:latest
|
||||||
volumes: ["vol1", "vol2", "vol3"]
|
volumes: ["vol1", "vol2", "vol3"]
|
||||||
volumes:
|
volumes:
|
||||||
vol1: *default-volume
|
vol1: *default-volume
|
||||||
vol2:
|
vol2:
|
||||||
<< : *default-volume
|
<< : *default-volume
|
||||||
name: volume02
|
name: volume02
|
||||||
vol3:
|
vol3:
|
||||||
<< : *default-volume
|
<< : *default-volume
|
||||||
driver: default
|
driver: default
|
||||||
name: volume-local
|
name: volume-local
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in New Issue