Port forwarding Ubuntu – Docker

I have following problem:

Assume that I started two Docker containers on host machine: A and B.

  • Using docker volume with a NFS partition
  • Keep data in the external folder for mongodb docker container
  • How to configure priorities for Spark and OpenMPI to coexist on a cluster?
  • How do I copy a directory from one container to another container in Docker Compose?
  • Forward local SSH credentials to Docker container inside Vagrant VM
  • Exposing a Docker container port
  • 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:

    • http://example.com:2000
    • http://example.com:2001

    How to reach that?

  • How do I find a conflicting container that docker reports is not running?
  • Docker logging to container
  • How I can running GUI application on Docker for Mac?
  • Throttling Disk Utilization
  • How to set fixed ip address for container using docker-compose?
  • Gitlab Docker container behind reverse Proxy
  • 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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.