From 62d27c32ffd5042e79b0e3acebb134e384754b65 Mon Sep 17 00:00:00 2001 From: Govind Rai Date: Wed, 16 Jun 2021 16:47:28 -0700 Subject: [PATCH] Update WORKDIR command information Signed-off-by: Govind Rai (cherry picked from commit e12aade59585f360e3f87def2c67699c7feaf95d) Signed-off-by: Sebastiaan van Stijn --- docs/reference/builder.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/reference/builder.md b/docs/reference/builder.md index ce14b741c3f3..7e73282a7c00 100644 --- a/docs/reference/builder.md +++ b/docs/reference/builder.md @@ -1824,6 +1824,11 @@ RUN pwd The output of the final `pwd` command in this `Dockerfile` would be `/path/$DIRNAME` +If not specified, the default working directory is `/`. In practice, if you aren't building a Dockerfile from scratch (`FROM scratch`), +the `WORKDIR` may likely be set by the base image you're using. + +Therefore, to avoid unintended operations in unknown directories, it is best practice to set your `WORKDIR` explicitly. + ## ARG ```dockerfile