5

我正在寻找一种方法来更改反向 DNS 在 Docker 中解析的内容。

如果我将容器的 FQDN 设置为foo.bar我希望其 IP 的反向 DNS 查找解析为foo.bar,但它总是解析为<container_name>.<network_name>.

有什么办法可以改变吗?

4

1 回答 1

0

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):

于 2017-01-05T22:12:35.240 回答