Closed mtelvers closed 1 month ago
Running the Docker daemon in debug mode logs all DNS requests. It was clear that the names were being resolved but to the wrong addresses.
This thread describes the same issue, https://github.com/moby/moby/issues/41766, and while it doesn’t have an explanation, the workaround of adding endpoint_mode: dnsrr
works on this machine.
version: "3.7"
services:
web1:
image: nginx
deploy:
endpoint_mode: dnsrr
web2:
image: nginx
deploy:
endpoint_mode: dnsrr
@neomterry Do try adding deploy: endpoint_mode: dnsrr
this worked immediately in my use case.
When opam-health-check is deployed or updated the IP address of the containers needs to be manually updated within the Caddy container. I have been finding the address manually with
docker inspect
... then editing the
/etc/hosts
file in the Caddy container.The behaviour can be reproduced on the target machine using a docker stack like this:
After deploying the stack with
docker stack deploy --compose-file stack.yml test
, the issue can be seen by attempting tocurl
between the containers both by name and IP address:I cannot reproduce this behaviour on another machine.
This Stack Overflow post explains how the Docker DNS should work with IP Tables and namespaces.