Cli: Better description of --publish for "docker container run"

Created on 24 Jul 2017  路  5Comments  路  Source: docker/cli

Please better document the possible syntax for the --publish option to docker container run, or link to other documentation where the syntax is described. For example, mapping to a particular host interface or mapping a range of ports.

File: engine/reference/commandline/container_run.md, CC @mstanleyjones

Sorry if this issue doesn't quite fit the standard format. I'm moving it from the website repo.

kindocs

Most helpful comment

@Zebrilee where is that info to be found? Neither in https://docs.docker.com/engine/reference/run/ or docker help run, which is where it should be. In fact, if I explicitly search for your explanation, the first google hit is this very page here.
I think this issue is perfectly valid.

All 5 comments

Did this issue need any additional info?

no, just time 馃槄 everyone has been busy

Hi @thaJeztah,

I would like to help but I'm not sure how.
While looking at Docker's documentation I found things like

When you invoke docker run you can use either -p IP:host_port:container_port or -p IP::port to specify the external interface for one particular binding.
Or if you always want Docker port forwards to bind to one specific IP address, you can edit your system-wide Docker server settings and add the option --ip=IP_ADDRESS. Remember to restart your Docker server after editing this setting.

or

-P : Publish all exposed ports to the host interfaces
-p=[] : Publish a container峋縮 port or a range of ports to the host format: ip:hostPort:containerPort | ip::containerPort | hostPort:containerPort | containerPort
Both hostPort and containerPort can be specified as a range of ports. When specifying ranges for both, the number of container ports in the range must match the number of host ports in the range, for example:
-p 1234-1236:1234-1236/tcp
When specifying a range for hostPort only, the containerPort must not be a range. In this case the container port is published somewhere within the specified hostPort range. (e.g., -p 1234-1236:1234/tcp)
(use 'docker port' to see the actual mapping)

Is it a good place to start to suggest the additional info needed?
I'm wondering how much "verbose" it has to be in fact

thanks

@Zebrilee where is that info to be found? Neither in https://docs.docker.com/engine/reference/run/ or docker help run, which is where it should be. In fact, if I explicitly search for your explanation, the first google hit is this very page here.
I think this issue is perfectly valid.

@phil294 I was just suggesting an answer in order to help and make a PR... that's all

Was this page helpful?
0 / 5 - 0 ratings