mirror of https://github.com/docker/docs.git
ENGDOCS-1965 (#19236)
* ENGDOCS-1965 * Update content/compose/compose-file/13-merge.md Co-authored-by: Stephanie Aurelio <133041642+stephaurelio@users.noreply.github.com> --------- Co-authored-by: Stephanie Aurelio <133041642+stephaurelio@users.noreply.github.com>
This commit is contained in:
parent
f94771e77f
commit
7d55c16d5a
|
|
@ -180,4 +180,28 @@ services:
|
|||
read_only: false
|
||||
environment: {}
|
||||
ports: []
|
||||
```
|
||||
```
|
||||
|
||||
### Replace value
|
||||
|
||||
While `!reset` can be used to remove a declaration from a Compose file using an override file, `!override` allows you
|
||||
to fully replace an attribute, bypassing the standard merge rules. A typical example is to fully replace a resource definition, to rely on a distinct model but using the same name.
|
||||
|
||||
Merging the following example YAML trees:
|
||||
|
||||
```yaml
|
||||
networks:
|
||||
foo:
|
||||
# this is production configuration
|
||||
name: production-overlay-network
|
||||
driver: overlay
|
||||
driver-opts: (...)
|
||||
```
|
||||
|
||||
```yaml
|
||||
networks:
|
||||
# this is development configuration
|
||||
foo: !override {}
|
||||
```
|
||||
|
||||
Results in a Compose application model equivalent to the override YAML tree.
|
||||
Loading…
Reference in New Issue