docker-alpine: Not resolving using search domain
Hostname is not properly resolving within the container when setting --dns-search on Docker.
Docker settings:
DOCKER_OPTS="--bip=172.17.42.1/16 --dns=172.17.42.1 --dns=10.0.2.15 --dns-search=service.consul"
gliderlabs/alpine
vagrant@local:~$ docker run --rm -it gliderlabs/alpine sh
/ # ping consul
ping: bad address 'consul'
/ # ping consul.service.consul
PING consul.service.consul (10.211.55.22): 56 data bytes
64 bytes from 10.211.55.22: seq=0 ttl=64 time=0.045 ms
progrium/busybox
vagrant@local:~$ docker run --rm -it progrium/busybox
/ # ping consul
PING consul (10.211.55.22): 56 data bytes
gliderlabs/registrator#111
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 95 (15 by maintainers)
Commits related to this issue
- Use debian as base image and bash for scripts Alpine is much smaller but it suffers from severe DNS issues. It lacks support for search domains and tries to resolve a dns name via all configure names... — committed to mesosphere/marathon-lb by discordianfish 9 years ago
- Switch to ubuntu baseimage. Alpine DNS is broken. https://github.com/gliderlabs/docker-alpine/issues/8#issuecomment-75288914 — committed to Nordstrom/kubernetes-vulcand-router by emmanuel 9 years ago
- Switch away from Alpine because of musl’s resolver behavior. See: https://github.com/gliderlabs/docker-alpine/issues/8#issuecomment-75288914 — committed to emmanuel/docker-aws-node-labels by emmanuel 9 years ago
- Switch away from Alpine because of musl’s resolver behavior. See: https://github.com/gliderlabs/docker-alpine/issues/8#issuecomment-75288914 — committed to emmanuel/docker-aws-node-labels by emmanuel 9 years ago
- Switch away from Alpine because of musl’s resolver behavior. See: https://github.com/gliderlabs/docker-alpine/issues/8#issuecomment-75288914 — committed to emmanuel/docker-aws-node-labels by emmanuel 9 years ago
- Make loadgen use FQDNs to workaround alpine bug Search domains are broken in alpine: https://github.com/gliderlabs/docker-alpine/issues/8 — committed to weaveworks/service by deleted user 8 years ago
- Use debian image for loadgen alpine, due to its use of Musl libc: * Doesn't respect search domains * Even when using FQDNs, it chokes on the 'options ndots:number' line added by k8s, causing DNS res... — committed to weaveworks/service by deleted user 8 years ago
- Updating base docker image to alpine. — committed to kubernetes-retired/heapster by vishh 9 years ago
- Don't use alpine as DNS search does not work there See: https://github.com/gliderlabs/docker-alpine/issues/8 — committed to kloudsec/redis-slave by RavenXce 8 years ago
- Use alpine edge as `search` in `/etc/resolv.conf` is not working See: https://github.com/gliderlabs/docker-alpine/issues/8 — committed to kloudsec/redis-slave by RavenXce 8 years ago
- Base on alpine:edge to get DNS fixes See https://twitter.com/thockin/status/704909611279781888 and https://github.com/gliderlabs/docker-alpine/issues/8. This will be fixed in 3.4, so at that point we... — committed to phpmyadmin/docker by nijel 8 years ago
- Base on alpine:edge to get DNS fixes Fix fromofficial phpMyAdmin: https://github.com/phpmyadmin/docker/commit/6dd6b90902e4a124ce20e93f3b456f23b30855d1 See https://twitter.com/thockin/status/704909... — committed to OlivierCuyp/dockerfiles by OlivierCuyp 8 years ago
- Created 2.0-latest using ubuntu There is a problem with alpine's ability to use Docker-cloud's dns searching capabilities. see: https://github.com/gliderlabs/docker-alpine/issues/8 — committed to seven10builder/jenkins-docker-distributed by seven10builder 8 years ago
- Bumping to Alpine 3.5. Mostly to avoid [this](https://github.com/gliderlabs/docker-alpine/issues/8) issue. — committed to rk295/docker-git2consul by rk295 7 years ago
- Update kafka 10 to newer alpine Motivation - current version doesn't use /etc/resolv.conf which prevents kubernetes usage with the current image. See https://github.com/gliderlabs/docker-alpine/issu... — committed to YonatanKiron/kafka-docker by deleted user 6 years ago
I’m not sure why this issue is closed as I’ve tested with the
alpine:latestakaalpine:3.4, and it still has this problem with not honoringsearch ...in/etc/resolv.conf. I’ve also tried some of the images and fixes that claim to have resolved the problem. None of them did for me.This is a major problem for containers deployed into a k8s cluster, where k8s service is a critical part of the end-to-end user experience. For example, the most downloaded image from docker hub is
nginx, and it’s based on alpine, and it’s broken when deployed into k8s.Just because no one has mentioned it yet… DNS search/domain resolution is really important in a kubernetes cluster. Kubernetes services are used for just about every integration point and they all resolve through DNS. Kubernetes injects the right information into /etc/resolv.conf to do this.
The fact that I can’t connect to myservice.mynamespace from within an alpine container prevents me from doing anything useful. For example, I have a service called etcd.system that resolves to etcd host for http puts and gets. A very common thing is to write to etcd via curl for application configuration, etc. Alpine is the smallest base image that easily lets you download and use curl, but because my kubernetes service, etcd.system, isn’t resolvable I am dead in the water.
I now have to use a 100 meg image to curl, when the 6 meg one would have done fine.
Just food for thought.
Very sad to see this broken in both 3.4 and the edge on k8s.
search:search:alpine does not support multiple nameservers as well. Only one
This issue still exists with current
alpine:3.4,alpine:3.5andalpine:edge.The problem remained for me: I tried using alpine:3.4 and alpine:edge …
/etc/resolv.conf:
nslookup kubernetes.default
nslookup kubernetes
Still have an issue with alpine 3.4 / kube-dns:1.9 Hope that kube-dns:2.x.x would fix this.
Sure, there is
Alpine-kubernetes: A base image that comes with a special sauce for giving SEARCH domain powers to Docker Alpine. See here: https://github.com/janeczku/docker-alpine-kubernetes.I’ve stumbled onto this same issue, and I’ve solved it removing the a
searchdirective, which was triggering a CloudFlare DNS (buggy) resolution.I’ve found out about the solution with this blog post: https://blog.maio.me/alpine-kubernetes-dns/
Try this:
@ansel1 @andyshinn just fyi - This is already included in 1.2.0 alpha line - https://github.com/kubernetes/kubernetes/releases/tag/v1.2.0-alpha.5 -
SkyDNS is the only NS for Pods with DNSPolicy=ClusterFirst (#15645, @ArtfulCoder)Alternatively we have a container called Resolvable that helps: https://github.com/gliderlabs/resolvable
same issue with alpine 3.5 and kubernetes 1.5.x 😦 Sometimes it works, and sometimes does not.
Even based on its own documentation this would appear to be a bug in musl libc:
While I can confirm the second part (queries greater than
ndotsnever fall-back to using search), the first part (queries smaller thanndotsfall-back to using an absolute query) isn’t what I observe.Using
digon an Ubuntu container and attempting to resolve the nonsensical querygoogle.com.default.svc.cluster.local(simulates the type of initial query for a short domain that would be occurring) returns aQUESTION SECTIONand anAUTHORITY SECTION, but noANSWER SECTION. This should cause musl libc to attempt to resolve the absolute query (google.com) instead, yet it doesn’t seem to based on the final result of the query.Here’s the (tiny) commit where support for
searchanddomainwas added to musl libc, and here’s thename_from_dnsfunction that that diff relies on. I think thisdns_parse_callbackfunction maybe the thing that determines whether we consider we’ve received a result or not, yet the code indicates this would only occur if we receive either anA,AAAAorCNAMErecord, yet in our case there’s noANSWER SECTIONwhatsoever.… 😕
I set up a dnsmasq container. In
resolv.dnsmasq.conf, I addedIn alpine container I set the dns pointing to that dnsmasq container.
The problem is when I do
ping basein alpine container, the log of dnsmasq shows that onlybaseis sent to8.8.8.8, butbase.example.comis never queried.I think it could use a full dnsmasq config for the custom+upstream DNS scenario so people can figure out how to run it on the host, then a pointer to a good generic dnsmasq Docker container that would be easy to apply that configuration for people that want to run it in a container, and lastly, once available, a pointer to our magic resolve container.
On Tue, Mar 24, 2015 at 3:36 PM, Aris Pikeas notifications@github.com wrote:
Jeff Lindsay http://progrium.com