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?

  • SQL scripts inside /docker-entrypoint-initdb.d directory are not executed
  • Unhandled promise rejection in Docker with 'opn' npm module
  • Moving Phundament web app to production
  • Using docker-compose Mysql + App
  • When using docker load on a tarball I am getting an invalid argument
  • How to start selenium hub and one linked node via docker-compose instead of using docker?
  • Best regards and thanks.

  • Can't get Pod info in the kubernetes cluster
  • GitlabCI run docker review app
  • Importing a python module in Jython StreamSets - ImportError: No module named
  • side effect of --rm: when exit a container build with docker run --rm -v /myvol, also the volume is removed
  • File permissions for mapped folders on host machine
  • Integrate private files for open source application code in devops pipeline
  • 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.