[ 
https://issues.apache.org/jira/browse/YARN-5168?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16688056#comment-16688056
 ] 

Shane Kumpf commented on YARN-5168:
-----------------------------------

I believe there are two options, and we may want to support both.

{{-P}} - Sets up port mappings based on the EXPOSE directives in the 
Dockerfile. Each EXPOSE'd port will be mapped to an ephemeral port on the NM 
host. Docker manages which ephemeral port is used on the NM side.
{{-p <port>}} - Allow the user to provide the container port that should be 
exposed (note that is NOT <port>:<port> which would be problematic). Each user 
supplied port will be mapped to an ephemeral port on the NM host. Docker 
manages which ephemeral port is used on the NM side. This would be useful when 
the user has forgotten to add the EXPOSE directive to the Dockerfile and would 
avoid the need to modify the image to expose a port. Note that we'd need the 
user supplied input to be able to support tcp and udp ports. These could be two 
separate env variables that contain a comma separated list of ports. 

{quote}The -P parameter is very useful. You can do this -P 8080, let the host 
pick an unoccupied port and bind it to the 8080 port of the container. Then the 
user can know which physical port is used by obtaining the container 
information.{quote}

What version of Docker does this work on? I'm only able to get the -p 8080 
option to do what you state above. -P requires the EXPOSE directive in the 
Dockerfile.

> Add port mapping handling when docker container use bridge network
> ------------------------------------------------------------------
>
>                 Key: YARN-5168
>                 URL: https://issues.apache.org/jira/browse/YARN-5168
>             Project: Hadoop YARN
>          Issue Type: Sub-task
>            Reporter: Jun Gong
>            Assignee: Xun Liu
>            Priority: Major
>              Labels: Docker
>
> YARN-4007 addresses different network setups when launching the docker 
> container. We need support port mapping when docker container uses bridge 
> network.
> The following problems are what we faced:
> 1. Add "-P" to map docker container's exposed ports to automatically.
> 2. Add "-p" to let user specify specific ports to map.
> 3. Add service registry support for bridge network case, then app could find 
> each other. It could be done out of YARN, however it might be more convenient 
> to support it natively in YARN.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: yarn-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: yarn-issues-h...@hadoop.apache.org

Reply via email to