Docker Swarm and Consul production setup recommendation

dockerdocker-swarmhigh-availability

I'd like to set up a production HA Docker Swarm cluster.

Docker Swarm needs a Key Value store as a precondition, consul in this case.

Now I'm asking what a clever setup would be:

  • Consul should run in Docker containers
  • Consul must be HA and automatically scaleable
  • Consul containers should be managed with Docker Swarm (this would need consul running though)

Constraints

  • Running consul on the host is not an option
  • Having to manage consul containers manually is not an option
  • Docker Swarm with a Docker Hub token is not an option

Approach

Any ideas how this chicken or the egg problem can be solved in a clean and reliable manner for efficient operation?

Multiple swarm instances would certainly look like a reasonable approach but how to setup the initial swarm without consul and swarm? Thanks.

Best Answer

Jacob Blain Christen has a nice article about this very problem. In short: start the docker daemon with a reference to the not yet existing consul cluster, then start consul via docker. Citation:

Fortunately, the Docker daemon will happily retry to connect to the cluster-store aka the KVS every so often, this gives us time to underlay it via Docker Compose.

Hope this helps.

Related Topic