Docker Community Forums

Share and learn in the Docker community.

Reaching a container with a virtual ip from an external network


(Kubitux) #1

Hello every one
Does anyone have an idea to make a virtual ip switching from a container to another (on the same host), reachable from outside the docker host ? I can’t map a host port to the container with the virtual ip since it will be linked to the same container for ever, even it fails. How can I do “dynamic” mapping ? with or without virtual ip.
I use keepalived on my containers with --privileged=true, and my virtual ip works fine, going from one container to another when I kill the container with the vip.
The goal is to make a galera cluster with containers, on a single docker host ( or in a swarm cluster eventually), and to send some sql requests from outside my Docker Host. those requests should make a connection to the galera cluster through an unique IP address (the Docker host IP address), on port 3306.

Thank you !


(Timgriffiths) #2

Have you considered IPVS, there was a very interesting talk at the eu docker con last year, might be what your looking for, and might simplify your set up giving you these dynamic mappings.

https://blog.codeship.com/kernel-load-balancing-for-docker-containers-using-ipvs/?mkt_tok=3RkMMJWWfF9wsRonuqTMZKXonjHpfsX57uQsXKCxlMI%2F0ER3fOvrPUfGjI4DTMJgI%2BSLDwEYGJlv6SgFQ7LMMaZq1rgMXBk%3D