Windows: Clarify WORKDIR in docs
| ... | ... |
@@ -1268,6 +1268,19 @@ For example: |
| 1268 | 1268 |
The output of the final `pwd` command in this `Dockerfile` would be |
| 1269 | 1269 |
`/path/$DIRNAME` |
| 1270 | 1270 |
|
| 1271 |
+On Windows, `WORKDIR` behaves differently depending on whether using Windows |
|
| 1272 |
+Server containers or Hyper-V containers. For Hyper-V containers, the engine |
|
| 1273 |
+is, for architectural reasons, unable to create the directory if it does not |
|
| 1274 |
+previously exist. For Windows Server containers, the directory is created |
|
| 1275 |
+if it does not exist. Hence, for consistency between Windows Server and |
|
| 1276 |
+Hyper-V containers, it is strongly recommended to include an explict instruction |
|
| 1277 |
+to create the directory in the Dockerfile. For example: |
|
| 1278 |
+ |
|
| 1279 |
+ # escape=` |
|
| 1280 |
+ FROM microsoft/nanoserver |
|
| 1281 |
+ RUN mkdir c:\myapp |
|
| 1282 |
+ WORKDIR c:\myapp |
|
| 1283 |
+ |
|
| 1271 | 1284 |
## ARG |
| 1272 | 1285 |
|
| 1273 | 1286 |
ARG <name>[=<default value>] |