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?

  • docker does not create folder in nginx html root
  • How to convert docker run command into json file?
  • How to enable Redmines 'adding of issues' when using Docker?
  • Update docker container when new image is getting released
  • Connecting the Docker Daemon insde the CDK on RHEL based docker images
  • HTTP response 403 when trying to push to registry
  • Best regards and thanks.

  • Dockerfile with entrypoint for executing bash script
  • Docker Mount Volume Directory with Install Files
  • Error on Docker Pull - “Layer already being pulled by another client”
  • Issues running cron in Docker on different hosts
  • Run Omnet++ inside docker with x11 forwarding on windows. SSH not working
  • Mapping volumes to include subfolders in docker-compose
  • 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.