Skip to content

Commit

Permalink
docs: rewrite section on working directory
Browse files Browse the repository at this point in the history
Signed-off-by: David Karlsson <[email protected]>
  • Loading branch information
dvdksn committed Dec 12, 2023
1 parent 4a84514 commit 2e394eb
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions docs/reference/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -1230,7 +1230,14 @@ The followings examples are all valid:
### Working directory

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

-w="", --workdir="": Working directory inside the container
```text
$ docker run --rm -w /my/workdir alpine pwd
/my/workdir
```

If the directory doesn't already exist in the container, it will be created.

0 comments on commit 2e394eb

Please sign in to comment.