Docker Containers with different Network Interface

Problem:
I want to have multiple VPN Servers running in Docker containers each with there own public IP.

With the -p parameter I am able to connect to each one separately but the Public ip that I see is the eth0 interface not the one that I want it to be (eth0:1) so how can I create a new docker0 interface that uses eth0:1 as interface for the traffic?

  • Update existed docker image and all contains once Dockerfile changed
  • Starting Docker On Debian 8: No Sockets Found
  • Install packages from the Debian Snapshot Archives repo?
  • Logging output in Docker Quickstart Terminal
  • Get internal IP address of Docker container using Ansible
  • How to install docker's btrfs volume plugin?
  • Best regards and thanks.

  • Why does different container of same elasticsearch image on docker exits out?
  • What is the best way to iterate while building a docker container?
  • Extend docker container
  • Selenium for docker issue
  • Alpine variants of PHP and Apache/httpd in Docker
  • Using nginx to reverse proxy to Docker services
  • One Solution collect form web for “Docker Containers with different Network Interface”

    Docker doesn’t uses network outside of it .
    For the connection between the host to container from outside the world use port bindings.
    Expose the port in Dockerfile when creating docker image
    Expose Docker Container to Host :
    Exposing container is very important for the host to identify in which port container runs.
    -p in docker run command used to expose the ports.
    Syntax : docker run -p host_ip:host_port:container_port image_name
    e.g., docker run -itd -p 192.168.134.122:1234:1500 image_name
    This binds port 1500 of the container to port 1234 on 192.168.134.122 of the host machine.
    Use Iptables to view the network process – iptables -L -n -t nat

      Now the request send to host_ip (192.168.134.122) and port (1243) is redirect to container with ip (172.17.0.2) and port (1500).
    
    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.