Add host dns to docker container

raspberrypi3
docker

#1

I have added my router to the list of nameservers when making the OS and I can see it is in the /etc/resolv.conf on the Raspberry pi host. When I shell into the docker container and look at the resolv.conf it only has a dns entry for a server 10...*. With a regular docker container I can pass in nameservers using --dns=192.168.1.1

Does resin not use this? How can I get my router passed in the the container as a dns server? I have an app that looks for PhillipsHue by hostname (registered using UpnP). It works if I manually add my router to the dns entries for the container, but obviously this is wiped each time the container is updated.


#4

Hello,

you can set the “dnsServers” property in the config.json file in the boot partition. So you will need to add “dnsServers”: “XX.XX.XX.XX YY.YY.YY.YY” (space separated) in the config.json.
You can read more about reading and writing the config.json file here: https://docs.resin.io/tools/cli/#config-read


#6

Hi @izavits I have just added this key in the object and rebooted but nothing changed.

I have just looked in /run/dnsconf.servers and the entry I added is there, it’s just for whatever reason not able to be resolved in my container (the only dns entry there is nameserver 10.114.101.1 which I’m assuming is dnsMasq?