Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

how to bind docker containers to specific IP aliases

I have a VM with

  • a public IP Address on eth0
  • an internal private ip address on ens01 (10.0.0.1)
  • up to 5 private IP aliases on ens01 (10.0.0.2, .3, .4, .5, .6)

I want to route traffic to my docker containers through the private network from a reverse proxy running on another VM.

I want all containers to use host networking, but i want each listen on one and only one of the private IP addresses. For example every container should be able to listen on port 80 bound to its own private IP address.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

My plan is to put a firewall rule on the public IP to prevent any traffic from entering or leaving the VM through the public internet.

First of all, is this even possible? and if so how do I accomplish it?

>Solution :

This is possible, you need to create a macvlan network https://docs.docker.com/network/macvlan/
And assign your containers to it with their respective ip adresses.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading