Skip to content

Commit ad6338d

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

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

docs/reference/run.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1232,7 +1232,13 @@ The followings examples are all valid:
12321232
### Working directory
12331233

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

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

0 commit comments

Comments
 (0)