From d16a71e0f216c9762cb1fd705983fc04ba59e8a2 Mon Sep 17 00:00:00 2001 From: John Howard Date: Fri, 28 Oct 2016 10:28:38 -0700 Subject: [PATCH] Windows: Clarify WORKDIR in docs Signed-off-by: John Howard Upstream-commit: e87c6dd3e48135637d12067dd158252b5c27349b Component: engine --- components/engine/docs/reference/builder.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/components/engine/docs/reference/builder.md b/components/engine/docs/reference/builder.md index 19e693482f..d46119c1cd 100644 --- a/components/engine/docs/reference/builder.md +++ b/components/engine/docs/reference/builder.md @@ -1269,6 +1269,19 @@ For example: The output of the final `pwd` command in this `Dockerfile` would be `/path/$DIRNAME` +On Windows, `WORKDIR` behaves differently depending on whether using Windows +Server containers or Hyper-V containers. For Hyper-V containers, the engine +is, for architectural reasons, unable to create the directory if it does not +previously exist. For Windows Server containers, the directory is created +if it does not exist. Hence, for consistency between Windows Server and +Hyper-V containers, it is strongly recommended to include an explict instruction +to create the directory in the Dockerfile. For example: + + # escape=` + FROM microsoft/nanoserver + RUN mkdir c:\myapp + WORKDIR c:\myapp + ## ARG ARG [=]