Skip to content

Commit 3f807a4

Browse files
committed
Include the long form of options in dedicated section headings
Signed-off-by: Richard Gibson <richard.gibson@gmail.com>
1 parent 262a771 commit 3f807a4

1 file changed

Lines changed: 19 additions & 16 deletions

File tree

  • docs/reference/commandline

docs/reference/commandline/run.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ flag exists to allow special use-cases, like running Docker within Docker.
198198
### Set working directory (-w)
199199

200200
```console
201-
$ docker run -w /path/to/dir/ -i -t ubuntu pwd
201+
$ docker run -w /path/to/dir/ -i -t ubuntu pwd
202202
```
203203

204204
The `-w` lets the command being executed inside directory given, here
@@ -228,35 +228,38 @@ $ docker run -d --tmpfs /run:rw,noexec,nosuid,size=65536k my_image
228228
The `--tmpfs` flag mounts an empty tmpfs into the container with the `rw`,
229229
`noexec`, `nosuid`, `size=65536k` options.
230230

231-
### Mount volume (-v, --read-only)
231+
### Mount volume (-v, --volume, --read-only)
232+
233+
The `-v` flag allows you to mount volumes and host-directory
234+
mounts in a container.
235+
236+
Examples:
232237

233238
```console
234-
$ docker run -v `pwd`:`pwd` -w `pwd` -i -t ubuntu pwd
239+
$ docker run -v `pwd`:`pwd` -w `pwd` -i -t ubuntu pwd
235240
```
236241

237-
The `-v` flag mounts the current working directory into the container. The `-w`
238-
lets the command being executed inside the current working directory, by
239-
changing into the directory to the value returned by `pwd`. So this
240-
combination executes the command using the container, but inside the
241-
current working directory.
242+
This combination of `-v` to mount the current working directory into the
243+
container at the same absolute path and `-w` to use it as the working
244+
directory in the container executes the command using the container but
245+
inside the host's working directory.
242246

243247
```console
244248
$ docker run -v /doesnt/exist:/foo -w /foo -i -t ubuntu bash
245249
```
246250

247-
When the host directory of a bind-mounted volume doesn't exist, Docker
248-
will automatically create this directory on the host for you. In the
249-
example above, Docker will create the `/doesnt/exist`
250-
folder before starting your container.
251+
When the source directory of a bind-mounted volume doesn't exist, Docker
252+
will automatically create it on the host. In the example above, Docker
253+
will create the `/doesnt/exist` folder before starting the container.
251254

252255
```console
253256
$ docker run --read-only -v /icanwrite busybox touch /icanwrite/here
254257
```
255258

256259
Volumes can be used in combination with `--read-only` to control where
257-
a container writes files. The `--read-only` flag mounts the container's root
258-
filesystem as read only prohibiting writes to locations other than the
259-
specified volumes for the container.
260+
a container writes files. The `--read-only` flag mounts the container's
261+
root filesystem as read only, prohibiting writes to locations other than
262+
the specified volumes for the container.
260263

261264
```console
262265
$ docker run -t -i -v /var/run/docker.sock:/var/run/docker.sock -v /path/to/static-docker-binary:/usr/bin/docker busybox sh
@@ -316,7 +319,7 @@ $ docker run --read-only --mount type=volume,target=/icanwrite busybox touch /ic
316319
$ docker run -t -i --mount type=bind,src=/data,dst=/data busybox sh
317320
```
318321

319-
### Publish or expose port (-p, --expose)
322+
### Publish or expose port (-p, --publish, --expose)
320323

321324
```console
322325
$ docker run -p 127.0.0.1:80:8080/tcp ubuntu bash

0 commit comments

Comments
 (0)