forked from docker/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document new features in Compose 1.17 (docker#5019) (docker#5021)
Signed-off-by: Joffrey F <[email protected]>
- Loading branch information
Misty Stanley-Jones
authored
Oct 18, 2017
1 parent
bcafc55
commit 52fe0df
Showing
8 changed files
with
168 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
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. | ||
|
||
version: '2.1' | ||
x-custom: | ||
items: | ||
- a | ||
- b | ||
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: | ||
|
||
logging: | ||
options: | ||
max-size: '12m' | ||
max-file: 5 | ||
driver: json-file | ||
|
||
You may write your Compose file as follows: | ||
|
||
version: '2.1' | ||
x-logging: | ||
&default-logging | ||
options: | ||
max-size: '12m' | ||
max-file: 5 | ||
driver: json-file | ||
|
||
services: | ||
web: | ||
image: myapp/web:latest | ||
logging: *default-logging | ||
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: | ||
|
||
version: '2.1' | ||
x-volumes: | ||
&default-volume | ||
driver: foobar-storage | ||
|
||
services: | ||
web: | ||
image: myapp/web:latest | ||
volumes: ["vol1", "vol2", "vol3"] | ||
volumes: | ||
vol1: *default-volume | ||
vol2: | ||
<< : *default-volume | ||
name: volume02 | ||
vol3: | ||
<< : *default-volume | ||
driver: default | ||
name: volume-local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters