updated include file to use code fences (#5229)

Signed-off-by: Victoria Bialas <victoria.bialas@docker.com>
This commit is contained in:
Victoria Bialas 2017-11-06 16:15:52 -08:00 committed by GitHub
parent d2091304ee
commit dfe6ee6cd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 38 additions and 30 deletions

View File

@ -2,6 +2,7 @@ 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
your Compose file and their name start with the `x-` character sequence.
```none
version: '2.1'
x-custom:
items:
@ -10,20 +11,24 @@ your Compose file and their name start with the `x-` character sequence.
options:
max-size: '12m'
name: "custom"
```
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).
For example, if you want several of your services to use the same logging
configuration:
```none
logging:
options:
max-size: '12m'
max-file: 5
driver: json-file
```
You may write your Compose file as follows:
```none
version: '2.1'
x-logging:
&default-logging
@ -39,10 +44,12 @@ services:
db:
image: mysql:latest
logging: *default-logging
```
It is also possible to partially override values in extension fields using
the [YAML merge type](http://yaml.org/type/merge.html). For example:
```none
version: '2.1'
x-volumes:
&default-volume
@ -61,3 +68,4 @@ the [YAML merge type](http://yaml.org/type/merge.html). For example:
<< : *default-volume
driver: default
name: volume-local
```