Open carlosefr opened 3 years ago
I just had the same issue so I just went back to 3.10 instead.
This issue has manifested itself in the ruby:2.7.3-alpine3.13 image now too. DNS lookups are fine on ruby:2.7.3-alpine3.12.
For me it seems to work on Linux but not on Docker for Mac, so it could be a Docker issue.
Same for 3.14, https://github.com/alpinelinux/docker-alpine/issues/165
I have the same issue with 3.13 in a k8s environment. Is there any workaround to fix this?
We switched our application to a custom resolver (aka a "stub resolver"). Most languages come with stub resolver implementations you can opt in to. We're using Ruby, which you can configure to use Ruby's own DNS resolver instead of the (broken) system one. Afaik there are similar solutions for most languages.
In my case there was only one domain that it was struggling to resolve, so I just added an --add-host
argument to the docker run command. The same can be achieved with host aliases in k8s: https://v1-17.docs.kubernetes.io/docs/concepts/services-networking/add-entries-to-pod-etc-hosts-with-host-aliases/
This might help some:
Create or add this in your /etc/docker/daemon.json
{ "dns": ["8.8.8.8", "192.168.0.1"] }
With this, you will be able to update and install packages.
But if you are connected with a VPN service like AT&T or CISCO, and you want to reach your internal serversfrom your containers, you may want to use --add-host
.
I am hoping that this issue will get fixed soon, I am still using alpine:3.10.4
for my images because of this problem.
I would not hold my breath for this getting fixed any time soon, or ever. It's a deliberate choice of the underlying musl libc implementation to not support DNS over TCP, which is the root cause for some DNS requests not working.
This post might help shed some more light on what is going on and why some DNS queries just won't resolve with Alpine: https://christoph.luppri.ch/fixing-dns-resolution-for-ruby-on-alpine-linux/
Workaround: Install dnsmasq, forward to your original DNS, and change your resolv.conf to use 127.0.0.1:53
I would not hold my breath for this getting fixed any time soon, or ever. It's a deliberate choice of the underlying musl libc implementation to not support DNS over TCP, which is the root cause for some DNS requests not working.
This post might help shed some more light on what is going on and why some DNS queries just won't resolve with Alpine: https://christoph.luppri.ch/fixing-dns-resolution-for-ruby-on-alpine-linux/
I have not found a bug tracker for musl, however I have found this feature requests for DNS-over-TCP. I do not know if that's the currnet optinion of musl's author(s) on the DNS-over-TCP issue.
Fix for k8s (this is an example for a Deployment - adapt accordingly for Pods etc.)
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deployment
spec:
template:
spec:
dnsConfig:
nameservers:
# replace with DNS resolver that works for you
- 1.1.1.1
If you are using Helm Chart, then you might want to use a post-renderer to fix the DNS problem.
DNS lookups seem broken in the
alpine:3.13
docker image.I'm seeing this with docker 20.10.5 on CentOS 7.9, CentOS 8.3, and Ubuntu 20.04 LTS, all running as VMs on virtualbox/vagrant but noticed that it works with docker 20.10.5 on macOS and with CentOS 7.9 on a DigitalOcean VM that I have...
Investigating further, I see that on the vagrant VMs the problem goes away if I remove this line from my
Vagrantfile
: