Преглед изворни кода

Merge pull request #16100 from ZJU-SEL/fix-document-about-vol

fix doc about vol
Sebastiaan van Stijn пре 9 година
родитељ
комит
9d0954a83d
3 измењених фајлова са 40 додато и 1 уклоњено
  1. 13 0
      docs/reference/run.md
  2. 13 0
      docs/userguide/dockervolumes.md
  3. 14 1
      man/docker-run.1.md

+ 13 - 0
docs/reference/run.md

@@ -1261,6 +1261,19 @@ one or more `VOLUME`'s associated with an image, but only the operator
 can give access from one container to another (or from a container to a
 can give access from one container to another (or from a container to a
 volume mounted on the host).
 volume mounted on the host).
 
 
+The `container-dir` must always be an absolute path such as `/src/docs`. 
+The `host-dir` can either be an absolute path or a `name` value. If you 
+supply an absolute path for the `host-dir`, Docker bind-mounts to the path 
+you specify. If you supply a `name`, Docker creates a named volume by that `name`.
+
+A `name` value must start with start with an alphanumeric character, 
+followed by `a-z0-9`, `_` (underscore), `.` (period) or `-` (hyphen). 
+An absolute path starts with a `/` (forward slash).
+
+For example, you can specify either `/foo` or `foo` for a `host-dir` value. 
+If you supply the `/foo` value, Docker creates a bind-mount. If you supply 
+the `foo` specification, Docker creates a named volume.
+
 ### USER
 ### USER
 
 
 `root` (id = 0) is the default user within a container. The image developer can
 `root` (id = 0) is the default user within a container. The image developer can

+ 13 - 0
docs/userguide/dockervolumes.md

@@ -105,6 +105,19 @@ image, the `/src/webapp` mount overlays but does not remove the pre-existing
 content. Once the mount is removed, the content is accessible again. This is
 content. Once the mount is removed, the content is accessible again. This is
 consistent with the expected behavior of the `mount` command.
 consistent with the expected behavior of the `mount` command.
 
 
+The `container-dir` must always be an absolute path such as `/src/docs`. 
+The `host-dir` can either be an absolute path or a `name` value. If you 
+supply an absolute path for the `host-dir`, Docker bind-mounts to the path 
+you specify. If you supply a `name`, Docker creates a named volume by that `name`.
+
+A `name` value must start with start with an alphanumeric character, 
+followed by `a-z0-9`, `_` (underscore), `.` (period) or `-` (hyphen). 
+An absolute path starts with a `/` (forward slash).
+
+For example, you can specify either `/foo` or `foo` for a `host-dir` value. 
+If you supply the `/foo` value, Docker creates a bind-mount. If you supply 
+the `foo` specification, Docker creates a named volume.
+
 If you are using Docker Machine on Mac or Windows, your Docker daemon has only limited access to your OS X or Windows filesystem. Docker Machine tries
 If you are using Docker Machine on Mac or Windows, your Docker daemon has only limited access to your OS X or Windows filesystem. Docker Machine tries
 to auto-share your `/Users` (OS X) or `C:\Users` (Windows) directory.  So,
 to auto-share your `/Users` (OS X) or `C:\Users` (Windows) directory.  So,
 you can mount files or directories on OS X using.
 you can mount files or directories on OS X using.

+ 14 - 1
man/docker-run.1.md

@@ -440,7 +440,20 @@ content label. Shared volume labels allow all containers to read/write content.
 The `Z` option tells Docker to label the content with a private unshared label.
 The `Z` option tells Docker to label the content with a private unshared label.
 Only the current container can use a private volume.
 Only the current container can use a private volume.
 
 
-Note: Multiple Volume options can be added separated by a ","
+The `container-dir` must always be an absolute path such as `/src/docs`. 
+The `host-dir` can either be an absolute path or a `name` value. If you 
+supply an absolute path for the `host-dir`, Docker bind-mounts to the path 
+you specify. If you supply a `name`, Docker creates a named volume by that `name`.
+
+A `name` value must start with start with an alphanumeric character, 
+followed by `a-z0-9`, `_` (underscore), `.` (period) or `-` (hyphen). 
+An absolute path starts with a `/` (forward slash).
+
+For example, you can specify either `/foo` or `foo` for a `host-dir` value. 
+If you supply the `/foo` value, Docker creates a bind-mount. If you supply 
+the `foo` specification, Docker creates a named volume.
+
+**Note:** Multiple Volume options can be added separated by a , (comma).
 
 
 **--volumes-from**=[]
 **--volumes-from**=[]
    Mount volumes from the specified container(s)
    Mount volumes from the specified container(s)