Add note about host-dir in VOLUME
(cherry picked from commit f2fff9d913a8ab0436dd56033189a7c3713a59a2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -1281,18 +1281,28 @@ This Dockerfile results in an image that causes `docker run`, to |
| 1281 | 1281 |
create a new mount point at `/myvol` and copy the `greeting` file |
| 1282 | 1282 |
into the newly created volume. |
| 1283 | 1283 |
|
| 1284 |
-> **Note**: |
|
| 1285 |
-> When using Windows-based containers, the destination of a volume inside the |
|
| 1286 |
-> container must be one of: a non-existing or empty directory; or a drive other |
|
| 1287 |
-> than C:. |
|
| 1284 |
+### Notes about specifying volumes |
|
| 1288 | 1285 |
|
| 1289 |
-> **Note**: |
|
| 1290 |
-> If any build steps change the data within the volume after it has been |
|
| 1291 |
-> declared, those changes will be discarded. |
|
| 1286 |
+Keep the following things in mind about volumes in the `Dockerfile`. |
|
| 1292 | 1287 |
|
| 1293 |
-> **Note**: |
|
| 1294 |
-> The list is parsed as a JSON array, which means that |
|
| 1295 |
-> you must use double-quotes (") around words not single-quotes (').
|
|
| 1288 |
+- **Volumes on Windows-based containers**: When using Windows-based containers, |
|
| 1289 |
+ the destination of a volume inside the container must be one of: |
|
| 1290 |
+ |
|
| 1291 |
+ - a non-existing or empty directory |
|
| 1292 |
+ - a drive other than `C:` |
|
| 1293 |
+ |
|
| 1294 |
+- **Changing the volume from within the Dockerfile**: If any build steps change the |
|
| 1295 |
+ data within the volume after it has been declared, those changes will be discarded. |
|
| 1296 |
+ |
|
| 1297 |
+- **JSON formatting**: The list is parsed as a JSON array. |
|
| 1298 |
+ You must enclose words with double quotes (`"`)rather than single quotes (`'`). |
|
| 1299 |
+ |
|
| 1300 |
+- **The host directory is declared at container run-time**: The host directory |
|
| 1301 |
+ (the mountpoint) is, by its nature, host-dependent. This is to preserve image |
|
| 1302 |
+ portability. since a given host directory can't be guaranteed to be available |
|
| 1303 |
+ on all hosts.For this reason, you can't mount a host directory from |
|
| 1304 |
+ within the Dockerfile. The `VOLUME` instruction does not support specifying a `host-dir` |
|
| 1305 |
+ parameter. You must specify the mountpoint when you create or run the container. |
|
| 1296 | 1306 |
|
| 1297 | 1307 |
## USER |
| 1298 | 1308 |
|