Assign DNS name to Docker Swarm containers with public IPv6 I'm trying to understand how I would set up a Docker container (running in Swarm mode) with publicly available IPv6.

I know Docker Swarm uses mesh routing, but I don't quite understand how I can dynamically assign DNS names to addresses.

As an example, let's say I want to run a Git server (with HTTP 80 443 and SSH 22) on git.example.com and a regular web server at example.com (with HTTP 80 443). Both have public IPv6 addresses, but I don't want to hard-code the IPv6 address (for example at CloudFlare). After all, this is DevOps!

How would I go about doing this? I assume I need to run my own DNS server for this.

Note: After doing some more research, it seems this is possible with the Docker HTTP Routing Mesh (HRM) which is unfortunately only part of the Enterprise Edition. Does anyone know a similar, open-source approach to this?
Assuming that "publicly available" is on the public internet it will be difficult.

DNS isn't really that reactive to changes and is challenging to run in a secure fashion on the public internet.

It also depends on what protocol you are running, because of an oddity around SRV records where pre-existing protocols were excluded from supporting it in the RFC.

But in general the public and the private solution I would implement are similar with an additional layer for a public internet solution. (assuming no use of a 3rd party or geo specific answers)

On the internet edge use Unbound DNS server on the edge, and have it relay queries to consul which would handle service registration.

If this is for private usage this would allow for some data-center awareness and fail-over.

If it is just for internal use you can just use consul and either configure your internal DNS servers to delegate subdomains or forward to the default domain.