Open Livenux opened 3 years ago
can you try dig example-service
to see the actual DNS entry on the docker engine DNS? (you may need to use something like an ubuntu container and then apt install dnsutils
to install dig). This seems similar to the issue I am having where the DNS entry on the docker engine DNS server is incorrect. #41766
In the linked issue, the A record is always off by minus 1. ie, the actual container IP 10.0.4.8 is listed as 10.0.4.7 in the DNS record. Is the DNS record constantly changing for you?
can you try
dig example-service
to see the actual DNS entry on the docker engine DNS? (you may need to use something like an ubuntu container and thenapt install dnsutils
to install dig). This seems similar to the issue I am having where the DNS entry on the docker engine DNS server is incorrect. #41766In the linked issue, the A record is always off by minus 1. ie, the actual container IP 10.0.4.8 is listed as 10.0.4.7 in the DNS record. Is the DNS record constantly changing for you?
It may be that when the number of docker swarm service instances was 3, three dns records were recorded, and when I changed the number of instances to 2, the dns records were not deleted, and this IP was occupied by other services, resulting in dns parsing errors.
dig example-service
; <<>> DiG 9.11.5-P4-5.1+deb10u2-Debian <<>> example-service
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 49236
;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 0
;; QUESTION SECTION:
;redis-proxy. IN A
;; ANSWER SECTION:
example-service. 600 IN A 172.29.4.155
example-service. 600 IN A 172.29.4.77
example-service. 600 IN A 172.29.4.154
;; Query time: 0 msec
;; SERVER: 127.0.0.11#53(127.0.0.11)
;; WHEN: Tue Dec 15 17:10:19 CST 2020
;; MSG SIZE rcvd: 110
update: When the docker swarm service is in dnsrr mode, the dns record will be n+1 of the number of instances, and one of the dns records is wrong.
@Livenux I discovered that the IP address of the service itself will be one minus the container IP. You can see the service vitrual IP by using docket network inspect -v
@Livenux I discovered that the IP address of the service itself will be one minus the container IP. You can see the service vitrual IP by using docket network inspect -v . The -v is required for verbose mode to see the service VIP. Does the DNS record from dig match up with the service IP?
is not a service VIP. is a dns cache(The ipvs mode should be a dns record, and dnsrr should be the number of instances of service, right?). I remove the dnsrr service, recreate new same name ipvs mode service, The wrong IP is still be resolved to the newly created service。
Hello,
I have a similar issue with docker 24.0.6 (this is not the latest, but haven't found anything related to this in recent changelogs).
I have many services (backend) with DNS RR resolution mode. The backend services have 2 replicas. Services are sometime updated (so containers are created/destroyed).
We have connection issues from others services (reverse proxy) to some of these (backend): delay added because of timeout trying to connect to some containers IP before falling back to another IP.
While debugging (docker exec
on reverse proxy), we found that more IP addresses than the number of containers are returned by the internal resolver (sometime even 4 IP addresses are returned):
getent ahosts a-problematic-backend-service
172.31.158.180 STREAM a-problematic-backend-service
172.31.158.180 DGRAM
172.31.158.180 RAW
172.31.156.25 STREAM
172.31.156.25 DGRAM
172.31.156.25 RAW
172.31.159.84 STREAM
172.31.159.84 DGRAM
172.31.159.84 RAW
While backend services without issue would only return 2 IP addresses.
To resolve the issue, I tried (without success):
Is there a way to force docker internal DNS resolver to do a re-synchronization or other workaround to make it forget the wrong IP addresses (without deleting/recreating the services)?
On a 4-node docker swarm cluster, a two-instance service was released using dnsrr mode. I found that one of the dns resolutions was wrong. When using multiple pings, the dns resolved to a container of another service.
Steps to reproduce the issue:
Describe the results you received: ping example-service 64 bytes from example-service.1.xxxxx .... ping example-service 64 bytes from another-service.2.xxxx
Describe the results you expected: ping example-service 64 bytes from example-service.1.xxxxx .... ping example-service 64 bytes from example-service.2.xxxx
Additional information you deem important (e.g. issue happens only occasionally):
Output of
docker version
:Output of
docker info
:Additional environment details (AWS, VirtualBox, physical, etc.):