mirror of https://github.com/docker/cli.git
docs: rewrite section on working directory
Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
parent
4a84514552
commit
2e394eb5f4
|
@ -1230,7 +1230,14 @@ The followings examples are all valid:
|
||||||
### Working directory
|
### Working directory
|
||||||
|
|
||||||
The default working directory for running binaries within a container is the
|
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
|
root directory (`/`). The default working directory of an image is set using
|
||||||
Dockerfile `WORKDIR` command. The operator can override this with:
|
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.
|
||||||
|
|
Loading…
Reference in New Issue