Customize Docker reverse DNS

1.7k views Asked by At

I'm looking for a way to change what the reverse DNS resolves to in Docker.

If I set my container's FQDN to foo.bar I expect a reverse DNS lookup for its IP to resolve to foo.bar, but it always resolves to <container_name>.<network_name>.

Is there a way I can change that?

1

There are 1 answers

0
Mark O'Connor On

Docker's DNS support is designed to support container discovery within a cluster. It's not an application traffic management solution, so features are limited.

For example it's possible to configure a DNS wildcard which resolves "*.foo.bar" urls to a server running a container savvy load balancer solution (A load balancer that knows where all the containers, associated with each application, are located and running).

That load balancer can then route traffic based on the incoming "Hostname" HTTP header:

  • "app1.foo.bar" -> "App1 Container1", "App1 Container2"
  • "app2.foo.bar" -> "App2 Container1", "App2 Container2", "App2 Container3"

For a practical implementation take a look at how Kubernetes does load balancing (This is an advanced topic):