mirror of https://github.com/docker/compose.git
Update merge docs with depends_on, and correction about how links and volumes_from are merged.
Signed-off-by: Daniel Nephin <dnephin@docker.com>
This commit is contained in:
parent
e32863f89e
commit
3ec87adccc
|
@ -32,12 +32,9 @@ contains your base configuration. The override file, as its name implies, can
|
||||||
contain configuration overrides for existing services or entirely new
|
contain configuration overrides for existing services or entirely new
|
||||||
services.
|
services.
|
||||||
|
|
||||||
If a service is defined in both files, Compose merges the configurations using
|
If a service is defined in both files Compose merges the configurations using
|
||||||
the same rules as the `extends` field (see [Adding and overriding
|
the rules described in [Adding and overriding
|
||||||
configuration](#adding-and-overriding-configuration)), with one exception. If a
|
configuration](#adding-and-overriding-configuration).
|
||||||
service contains `links` or `volumes_from` those fields are copied over and
|
|
||||||
replace any values in the original service, in the same way single-valued fields
|
|
||||||
are copied.
|
|
||||||
|
|
||||||
To use multiple override files, or an override file with a different name, you
|
To use multiple override files, or an override file with a different name, you
|
||||||
can use the `-f` option to specify the list of files. Compose merges files in
|
can use the `-f` option to specify the list of files. Compose merges files in
|
||||||
|
@ -176,10 +173,12 @@ is useful if you have several services that reuse a common set of configuration
|
||||||
options. Using `extends` you can define a common set of service options in one
|
options. Using `extends` you can define a common set of service options in one
|
||||||
place and refer to it from anywhere.
|
place and refer to it from anywhere.
|
||||||
|
|
||||||
> **Note:** `links` and `volumes_from` are never shared between services using
|
> **Note:** `links`, `volumes_from`, and `depends_on` are never shared between
|
||||||
> `extends`. See
|
> services using >`extends`. These exceptions exist to avoid
|
||||||
> [Adding and overriding configuration](#adding-and-overriding-configuration)
|
> implicit dependencies—you always define `links` and `volumes_from`
|
||||||
> for more information.
|
> locally. This ensures dependencies between services are clearly visible when
|
||||||
|
> reading the current file. Defining these locally also ensures changes to the
|
||||||
|
> referenced file don't result in breakage.
|
||||||
|
|
||||||
### Understand the extends configuration
|
### Understand the extends configuration
|
||||||
|
|
||||||
|
@ -275,13 +274,7 @@ common configuration:
|
||||||
|
|
||||||
## Adding and overriding configuration
|
## Adding and overriding configuration
|
||||||
|
|
||||||
Compose copies configurations from the original service over to the local one,
|
Compose copies configurations from the original service over to the local one.
|
||||||
**except** for `links` and `volumes_from`. These exceptions exist to avoid
|
|
||||||
implicit dependencies—you always define `links` and `volumes_from`
|
|
||||||
locally. This ensures dependencies between services are clearly visible when
|
|
||||||
reading the current file. Defining these locally also ensures changes to the
|
|
||||||
referenced file don't result in breakage.
|
|
||||||
|
|
||||||
If a configuration option is defined in both the original service the local
|
If a configuration option is defined in both the original service the local
|
||||||
service, the local value *replaces* or *extends* the original value.
|
service, the local value *replaces* or *extends* the original value.
|
||||||
|
|
||||||
|
|
|
@ -2313,7 +2313,7 @@ class ExtendsTest(unittest.TestCase):
|
||||||
tmpdir = py.test.ensuretemp('test_extends_with_defined_version')
|
tmpdir = py.test.ensuretemp('test_extends_with_defined_version')
|
||||||
self.addCleanup(tmpdir.remove)
|
self.addCleanup(tmpdir.remove)
|
||||||
tmpdir.join('docker-compose.yml').write("""
|
tmpdir.join('docker-compose.yml').write("""
|
||||||
version: 2
|
version: "2"
|
||||||
services:
|
services:
|
||||||
base:
|
base:
|
||||||
image: example
|
image: example
|
||||||
|
|
Loading…
Reference in New Issue