Browse code

Merge pull request #32735 from bhavin192/patch-1

Add note about host-dir in VOLUME

Sebastiaan van Stijn authored on 2017/04/26 02:18:16
Showing 1 changed files
... ...
@@ -1222,18 +1222,28 @@ This Dockerfile results in an image that causes `docker run`, to
1222 1222
 create a new mount point at `/myvol` and copy the  `greeting` file
1223 1223
 into the newly created volume.
1224 1224
 
1225
-> **Note**:
1226
-> When using Windows-based containers, the destination of a volume inside the
1227
-> container must be one of: a non-existing or empty directory; or a drive other
1228
-> than C:.
1225
+### Notes about specifying volumes
1229 1226
 
1230
-> **Note**:
1231
-> If any build steps change the data within the volume after it has been
1232
-> declared, those changes will be discarded.
1227
+Keep the following things in mind about volumes in the `Dockerfile`.
1233 1228
 
1234
-> **Note**:
1235
-> The list is parsed as a JSON array, which means that
1236
-> you must use double-quotes (") around words not single-quotes (').
1229
+- **Volumes on Windows-based containers**: When using Windows-based containers,
1230
+  the destination of a volume inside the container must be one of:
1231
+  
1232
+  - a non-existing or empty directory
1233
+  - a drive other than `C:`
1234
+
1235
+- **Changing the volume from within the Dockerfile**: If any build steps change the
1236
+  data within the volume after it has been declared, those changes will be discarded.
1237
+
1238
+- **JSON formatting**: The list is parsed as a JSON array.
1239
+  You must enclose words with double quotes (`"`)rather than single quotes (`'`).
1240
+
1241
+- **The host directory is declared at container run-time**: The host directory
1242
+  (the mountpoint) is, by its nature, host-dependent. This is to preserve image
1243
+  portability. since a given host directory can't be guaranteed to be available
1244
+  on all hosts.For this reason, you can't mount a host directory from
1245
+  within the Dockerfile. The `VOLUME` instruction does not support specifying a `host-dir`
1246
+  parameter.  You must specify the mountpoint when you create or run the container.
1237 1247
 
1238 1248
 ## USER
1239 1249