Browse code

Merge pull request #16287 from mikebrow/16055-man-update-for-docker-run-with-host-volumes

man update for docker run with host volumes

moxiegirl authored on 2015/10/10 01:24:11
Showing 3 changed files
... ...
@@ -1309,12 +1309,16 @@ container's `/etc/hosts` entry will be automatically updated.
1309 1309
 
1310 1310
 ### VOLUME (shared filesystems)
1311 1311
 
1312
-    -v=[]: Create a bind mount with: [host-dir:]container-dir[:rw|ro].
1313
-           If 'host-dir' is missing, then docker creates a new volume.
1312
+    -v=[]: Create a bind mount with: [host-dir:]container-dir[:<options>], where
1313
+    options are comma delimited and selected from [rw|ro] and [z|Z]. 
1314
+           If 'host-dir' is missing, then docker creates a new volume. 
1314 1315
 		   If neither 'rw' or 'ro' is specified then the volume is mounted
1315 1316
 		   in read-write mode.
1316 1317
     --volumes-from="": Mount all volumes from the given container(s)
1317 1318
 
1319
+> **Note**:
1320
+> The auto-creation of the host path has been [*deprecated*](/misc/deprecated/#auto-creating-missing-host-paths-for-bind-mounts).
1321
+
1318 1322
 The volumes commands are complex enough to have their own documentation
1319 1323
 in section [*Managing data in
1320 1324
 containers*](/userguide/dockervolumes). A developer can define
... ...
@@ -142,7 +142,7 @@ Mounting a host directory can be useful for testing. For example, you can mount
142 142
 source code inside a container. Then, change the source code and see its effect
143 143
 on the application in real time. The directory on the host must be specified as
144 144
 an absolute path and if the directory doesn't exist Docker will automatically
145
-create it for you.
145
+create it for you.  This auto-creation of the host path has been [*deprecated*](/userguide/dockervolumes/#auto-creating-missing-host-paths-for-bind-mounts).
146 146
 
147 147
 Docker volumes default to mount in read-write mode, but you can also set it to
148 148
 be mounted read-only.
... ...
@@ -165,6 +165,20 @@ user with access to host and its mounted directory.
165 165
 >should be portable. A host directory wouldn't be available on all potential
166 166
 >hosts.
167 167
 
168
+### Volume labels
169
+
170
+Labeling systems like SELinux require that proper labels are placed on volume
171
+content mounted into a container. Without a label, the security system might
172
+prevent the processes running inside the container from using the content. By
173
+default, Docker does not change the labels set by the OS.
174
+
175
+To change a label in the container context, you can add either of two suffixes
176
+`:z` or `:Z` to the volume mount. These suffixes tell Docker to relabel file
177
+objects on the shared volumes. The `z` option tells Docker that two containers
178
+share the volume content. As a result, Docker labels the content with a shared
179
+content label. Shared volume labels allow all containers to read/write content.
180
+The `Z` option tells Docker to label the content with a private unshared label.
181
+Only the current container can use a private volume.
168 182
 
169 183
 ### Mount a host file as a data volume
170 184
 
... ...
@@ -430,9 +430,17 @@ standard input.
430 430
 ""--ulimit""=[]
431 431
     Ulimit options
432 432
 
433
-**-v**, **--volume**=[]
434
-   Bind mount a volume (e.g., from the host: -v /host:/container, from Docker: -v /container)
435
-
433
+**-v**, **--volume**=[] Create a bind mount 
434
+   (format: `[host-dir:]container-dir[:<suffix options>]`, where suffix options
435
+are comma delimited and selected from [rw|ro] and [z|Z].)
436
+   
437
+   (e.g., using -v /host-dir:/container-dir, bind mounts /host-dir in the
438
+host to /container-dir in the Docker container)
439
+   
440
+   If 'host-dir' is missing, then docker automatically creates the new volume
441
+on the host. **This auto-creation of the host path has been deprecated in
442
+Release: v1.9.**
443
+   
436 444
    The **-v** option can be used one or
437 445
 more times to add one or more mounts to a container. These mounts can then be
438 446
 used in other containers using the **--volumes-from** option.
... ...
@@ -467,8 +475,6 @@ For example, you can specify either `/foo` or `foo` for a `host-dir` value.
467 467
 If you supply the `/foo` value, Docker creates a bind-mount. If you supply 
468 468
 the `foo` specification, Docker creates a named volume.
469 469
 
470
-**Note:** Multiple Volume options can be added separated by a , (comma).
471
-
472 470
 **--volumes-from**=[]
473 471
    Mount volumes from the specified container(s)
474 472