Update networking.md (#3234)

This commit is contained in:
Wang Jie 2017-05-31 02:39:42 +08:00 committed by Misty Stanley-Jones
parent 3c6e878d39
commit 86894f0aef
1 changed files with 10 additions and 5 deletions

View File

@ -96,21 +96,26 @@ is on an overlay network, not a bridge network, as these are not routed.
The command to run the `nginx` webserver shown in [Getting
Started](index.md#explore-the-application-and-run-examples) is an example of this.
```shell
docker run -d -p 80:80 --name webserver nginx
```bash
$ docker run -d -p 80:80 --name webserver nginx
```
To clarify the syntax, the following two commands both expose port `80` on the
container to port `8000` on the host:
docker run --publish 8000:80 --name webserver nginx
docker run --p 8000:80 --name webserver nginx
```bash
$ docker run --publish 8000:80 --name webserver nginx
$ docker run --p 8000:80 --name webserver nginx
```
To expose all ports, use the `-P` flag. For example, the following command
starts a container (in detached mode) and the `-P` exposes all ports on the
container to random ports on the host.
docker run -d -P --name webserver nginx
```bash
$ docker run -d -P --name webserver nginx
```
See the [run command](/engine/reference/commandline/run.md) for more details on
publish options used with `docker run`.