浏览代码

Update merge docs with depends_on, and correction about how links and volumes_from are merged.

Signed-off-by: Daniel Nephin <[email protected]>
Daniel Nephin 10 年之前
父节点
当前提交
3ec87adccc
共有 2 个文件被更改,包括 11 次插入18 次删除
  1. 10 17
      docs/extends.md
  2. 1 1
      tests/unit/config/config_test.py

+ 10 - 17
docs/extends.md

@@ -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
-the same rules as the `extends` field (see [Adding and overriding
-configuration](#adding-and-overriding-configuration)), with one exception.  If a
-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.
+If a service is defined in both files Compose merges the configurations using
+the rules described in [Adding and overriding
+configuration](#adding-and-overriding-configuration).
 
 
 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
-> `extends`. See
-> [Adding and overriding configuration](#adding-and-overriding-configuration)
- > for more information.
+> **Note:** `links`, `volumes_from`, and `depends_on` are never shared between
+> services using >`extends`. These exceptions exist to avoid
+> implicit dependencies&mdash;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.
 
 
 ### 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,
-**except** for `links` and `volumes_from`. These exceptions exist to avoid
-implicit dependencies&mdash;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.
-
+Compose copies configurations from the original service over to the local one.
 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.
 
 

+ 1 - 1
tests/unit/config/config_test.py

@@ -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