Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bind-tools needed for DNS lookups #339

Closed
rudijs opened this issue Feb 27, 2017 · 8 comments
Closed

bind-tools needed for DNS lookups #339

rudijs opened this issue Feb 27, 2017 · 8 comments

Comments

@rudijs
Copy link

rudijs commented Feb 27, 2017

Hi,

When we build our node app we need to add the package bind-tools so that DNS lookups work.

Perhaps this should go into the Docker build for this official base image as it's such a common need/use case.

Example, here I fire up a container and run nslookup

± docker run --rm -it --name temp1 node:6.9.5-alpine sh
/ # nslookup google.com
nslookup: can't resolve '(null)': Name does not resolve

Name:      google.com
Address 1: 216.58.200.14 hkg12s11-in-f14.1e100.net
Address 2: 2404:6800:4005:806::200e hkg12s11-in-x0e.1e100.net

Fix the nslookup by adding bind-tools

apk add --update --no-cache bind-tools

DNS lookups all good:

/ # nslookup google.com
Server:         10.0.2.3
Address:        10.0.2.3#53

Non-authoritative answer:
Name:   google.com
Address: 216.58.200.14

I noticed this when I switched to alpine linux today, some of our node containers were unable to lookup hostnames it needs.

I don't mind adding bind-tools manually, just suggesting it might be valuable to have by default.

Hope this helps.

Thanks.

@Starefossen
Copy link
Member

Hi @rudijs, and thanks for this detailed guide. It will definitely help others in a similar situation.

The main point of the alpine image variant is to reduce the size of the image as much as possible and still be able to run Node.js. So, unless the package is required to run Node.js itself, or by a majority of Node.js programs we are inclined not to install any extra packages at this point.

We might consider making multiple alpine variants in the future, but as this point we do not want to increase the number of variants due to the maintenance overhead.

@rudijs
Copy link
Author

rudijs commented Feb 28, 2017

Hi @Starefossen

Yep that's all good, I understand.

I don't mind at all to add explicitly what the app needs.

In this case I dont mind adding bind-tools.

The only thing I'd mention to consider is the DNS is part of the node.js core, but by default it's not going to work with this Alpine image - so a built in core feature, not extra feature, will not work.

New users will get tripped up on this, and will see the same error and all spend the same time searching around for why this is so.

For me though like I said I don't mind at all, but it's worth considering and putting here in writing to Google to index and other users to find.

I'll go ahead and close this issue.

Cheers.

@mcblum
Copy link

mcblum commented Sep 24, 2019

@rudijs did you get DNS lookups to work within this container? It's driving me absolutely mad - for whatever reason I can't seem to query outside DNS.

@LaurentGoderre
Copy link
Member

@mcblum have you tried at the OS level to make sure it isn't a docker config issue?

@mcblum
Copy link

mcblum commented Sep 27, 2019

@LaurentGoderre I can't believe this was it, but every node just needed to be rebooted. I don't know why, but that fixed it. Sometimes one gets so in the weeds one forgets to try the easiest thing.

@LaurentGoderre
Copy link
Member

that's strange but glad you go it figured out!

@gaby
Copy link

gaby commented Aug 18, 2021

@Starefossen The bind-tools package adds just 1MB to the final image size, yet it greatly improves DNS lookups performance within Alpine for Docker/k8s deployments.

@chevcast
Copy link

chevcast commented Oct 25, 2022

New users will get tripped up on this, and will see the same error and all spend the same time searching around for why this is so.

Yuuuuuup. Throw me on the pile.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants