Docker Community Forums

Share and learn in the Docker community.

Why VRRP would be an awesome addition to Docker?


(Sam Saffron) #1

Docker 1.7 is going to ship with libnetwork

This opens to door to a wide variety of network configurations involving Docker.

I asked on Twitter if there are going to be any plans to add VRRP and got the reply:

The reply clearly does not fit in a tweet, so I wanted to demonstrate how Docker could work with built-in VRRP.


Use case: Redis master - slave with automatic failover.

Consider we have 2 machine running Docker on a shared network.

machine1# docker run redis/master -p 6379:10.0.0.1:6379 --vrrp-ip 10.1.1.1 --vrrp-publish 6379 --vrrp-router-id 1 --vrrp-weight 2
machine2# docker run redis/master -p 6379:10.0.0.2:6379 --vrrp-ip 10.1.1.1 --vrrp-publish 6379 --vrrp-router-id 1 -vrrp-weight 1

Explaining the param:

vrrp-ip : the ip address to publish
vrrp-publish: same as --publish but for the vrrp interface
vrrp-router-id : required by vrrp protocol for election process
vrrp-weight : weight of the “request” for ip, highest weight wins.

Then … immediately on the network 10.1.1.1 port 6379 would point to a highly available redis.

If machine1 dies (or container is stopped), machine2 takes over.

This kind of setup is doable today using keepalived, or vrrpd. But having Docker aware of this protocol would significantly simplify deployment.

It could be used for highly available haproxy instances, pg instances and more.