Skip to content

Commit 2e394eb

Browse files
committed
docs: rewrite section on working directory
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
1 parent 4a84514 commit 2e394eb

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

docs/reference/run.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,7 +1230,14 @@ The followings examples are all valid:
12301230
### Working directory
12311231

12321232
The default working directory for running binaries within a container is the
1233-
root directory (`/`). It is possible to set a different working directory with the
1234-
Dockerfile `WORKDIR` command. The operator can override this with:
1233+
root directory (`/`). The default working directory of an image is set using
1234+
the Dockerfile `WORKDIR` command. You can override the default working
1235+
directory for an image using the `-w` (or `--workdir`) flag for the `docker
1236+
run` command:
12351237

1236-
-w="", --workdir="": Working directory inside the container
1238+
```text
1239+
$ docker run --rm -w /my/workdir alpine pwd
1240+
/my/workdir
1241+
```
1242+
1243+
If the directory doesn't already exist in the container, it will be created.

0 commit comments

Comments
 (0)