November 2018
Beginner
230 pages
6h 4m
English
Now, let's return to our discussion of the container run command. Earlier, you saw an example of using the run command with the --publish parameter. Using the optional publish parameter allows you to specify what ports will be opened related to the run container. The --publish parameter includes pairs of port numbers separated by a colon. For example:
# create an nginx web-server that redirects host traffic from port 8080 to port 80 in the containerdocker container run --detach --name web-server1 --publish 8080:80 nginx
The first port number is associated with the host running the container. In the nginx example, 8080 is exposed on the host; in our case that would be http://localhost:8080. The second port number ...
Read now
Unlock full access