Port forwarding Ubuntu – Docker
I have following problem:
Assume that I started two Docker containers on host machine: A and B.
docker run A -ti -p 2000:2000 docker run B -ti -p 2001:2001
I want to be able to get to each of this containers FROM INTERNET by:
How to reach that?
One Solution collect form web for “Port forwarding Ubuntu – Docker”
The rest of the equation here is just normal TCP / IP flow. You’ll need to make sure of the following:
- If the host has some an implicit deny for incoming traffic on its physical interface, you will need to open up ports 2000 and 2001, just like you would for any service (Docker or not).
- If the host is behind a NAT or other external means of routing, you’ll need to punch holes for those ports there as well.
- You’ll need the external IP address (either the one attached to the host or the one in front of the NAT allowing access to the ports).
As far as Docker is concerned, you’ve done what is required to open the ports to the service running in that container correctly.