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?
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:
For a practical implementation take a look at how Kubernetes does load balancing (This is an advanced topic):