Docker-nginx: Alpine base cannot resolve links via DNS

Created on 9 Apr 2016  路  21Comments  路  Source: nginxinc/docker-nginx

Apparently there is an issue with DNS resolution in alpine. See: https://forums.docker.com/t/container-link-problem-in-docker-cloud/6445/12. This prevents nginx images from resolving linked containers via DNS, such as on Docker Cloud.

Using alpine:edge will apparently fix the issue.

Most helpful comment

Is this fixed with the recently released alpine 3.4?

All 21 comments

I volunteer @tianon to decide if it's worth doing now.

Heh :innocent:

IMO, since Alpine upstream doesn't have the fix in a release yet, we're
probably better off waiting for the next major release of Alpine since this
will be fixed for us then ("edge" is essentially Alpine's "unstable" or
"devel" suite)

That makes sense. FYI, I can confirm rebuilding the container with alpine:edge as a base does indeed fix the issue, making container links work correctly on Docker Cloud. Hopefully alpine will release soon!

Is this fixed with the recently released alpine 3.4?

This is not fixed in 3.4, no.

The nginx:alpine image was rebuilt with Alpine 3.4. Please test.

not fixed

For me it's fixed using 1.11.4-alpine,
Nginx is able to resolve upstreams and I am able to resolve names using host.

Can anyone confirm if it's really fixed? Thank you.

1.11.13-alpine not fixed.

Please test the nginx:alpine which is now based off alpine:3.5 to see if it's still an issue.

Works fine now for 1.13.0-alpine on macOS.

I just tried 1.13.0-alpine and 1.13.3-alpine, it seems the problem is still there.

I'm seeing this problem with 1.13 alpine as well, not RHEL 7.3

Are there any updates?

just tried with docker-nginx version debian which works fine, but version alpine still does not work, it seems that version alpine uses still alpine 3.5 which has DNS problem.

FROM alpine:3.5

https://github.com/nginxinc/docker-nginx/blob/master/mainline/alpine/Dockerfile#L1

I wonder how it worked for my case in April though. I am not working with it right now so won't be able to test it again.

It looks like problem is still here, so we can't use apline for swarm?

It works for me, but only when I add resolver 127.0.0.11; to the nginx config.

I'm going to guess that the reason people are seeing different results is because of this tiny bit of config and the environment in which they are working....

  resolver 127.0.0.11 valid=30s ipv6=off;
  resolver_timeout 5s;

So if your environment doesn't have ipv6 available, the resolver will fail almost instantaneously and you will lose some of your hair trying to figure out why.....

A way to test:

$ docker run -n app nginx:1.19.7-alpine
ceaa16117ed4b767ce1b045effaca14e154d002443e43ae4745e51af28396d0a
$ docker run --name web --link app:app nginx:1.19.7-alpine ping -c1 app
PING app (172.17.0.2): 56 data bytes
64 bytes from 172.17.0.2: seq=0 ttl=64 time=0.150 ms

--- app ping statistics ---
1 packets transmitted, 1 packets received, 0% packet loss
round-trip min/avg/max = 0.150/0.150/0.150 ms

So it works in current images. Closing it.

Was this page helpful?
0 / 5 - 0 ratings