Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion docs/reference/commandline/container_run.md
Original file line number Diff line number Diff line change
Expand Up @@ -521,12 +521,23 @@ $ docker run -t -i --mount type=bind,src=/data,dst=/data busybox sh

### <a name="publish"></a> Publish or expose port (-p, --expose)

The `-p` / `--publish` value is `[ip:][hostPort:]containerPort[/protocol]`.
`hostPort` can be a single port or a range (`8080-8081`).

```console
$ docker run -p 127.0.0.1:80:8080/tcp nginx:alpine
```

This binds port `8080` of the container to TCP port `80` on `127.0.0.1` of the
host. You can also specify `udp` and `sctp` ports. The [Networking overview
host. You can also specify `udp` and `sctp` ports. Omit the IP to publish on
all host interfaces (`0.0.0.0`). A range maps host ports onto container ports
in order:

```console
$ docker run -p 8080-8081:80-81 nginx:alpine
```

The [Networking overview
page](https://docs.docker.com/network/) explains in detail how to publish ports
with Docker.

Expand Down