colinmollenhour / mariadb-galera-swarm

MariaDb Galera Cluster container based on official mariadb image which can auto-bootstrap and recover cluster state.
https://hub.docker.com/r/colinmollenhour/mariadb-galera-swarm
Apache License 2.0
216 stars 101 forks source link

Implemented support for stacks with static hostnames for docker > 19.03 #94

Closed JKJameson closed 4 years ago

JKJameson commented 4 years ago

Deploying a stack will not work with the current release of docker, you need to have the next major release after 19.03. More info: https://github.com/moby/moby/pull/39204

The magic that allows this to happen is adding a line into docker-compose.yml hostname: "{{.Service.Name}}.{{.Task.Slot}}"

And voila, now external services such as haproxy can connect to your database servers (they must be on the same docker network in order to resolve the DNS).

colinmollenhour commented 4 years ago

Awesome, thanks!