Closed htilly closed 4 years ago
Thanks for the info! I haven't tried running this container as a client although I've seen some others here that have. Do you have a DNS= line in wg0.conf or no?
I do. As for now I have solved it by providing DNS thru the docker-compose file.. But would be good to fully utilise wg.
wg0.conf:
[Interface]
PrivateKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Address = 172.xx.xxx.xx/32, fd00:0000:xxx:cafe:1111:1111:xxx:xxx/128
DNS = 46.227.xx.xxx, 192.165.x.xxx
[Peer]
PublicKey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = vpn57.xxx.yyyyyy.xxxxx.com:9929
This seems to be working:
RUN echo resolvconf resolvconf/linkify-resolvconf boolean false | debconf-set-selections && \
echo "REPORT_ABSENT_SYMLINK=no" >> /etc/default/resolvconf && \
apt-get -y install resolvconf && apt-get -y install debconf-utils && \
apt clean
Played around a little with your code.. Changed some stuff for more client oriented things..
https://github.com/htilly/wireguard-docker
Did some more testing here and it seems that the change you mentioned above removes the warning message but the actual resolv.conf file in the container still does not get updated appropriately. This is a little tricky as docker has resolv.conf as a bind-mounted copy of the hosts resolv.conf file by design. This means wireguard can't use the resolvconf script since symlinks aren't allowed. Luckily you can still edit the resolv.conf file so probably will just have to do sort of a hack in the run script to set DNS appropriately.
Actually this was not as tricky as I thought, solved by using the openresolv package instead of resolvconf package
A bit late to the party but @cmulk for your docker use case you can bind-mount in your own resolv.conf file (which will give you read /write permissions to it)
along with the example htilly mentioned it works fine for me like this in docker.
Everything works except for DNS queries. Problem seems to be as the title says: /etc/resolv.conf is not a symbolic link to /etc/resolvconf/run/resolv.conf
If I manually configure /etc/resolv.conf to 1.1.1.1 or similar everything works as expected. /etc/resolvconf/run/resolv.conf contains the correct info.
dpkg-reconfigure resolvconf seems to be a way forward...
Logs:
My docker-compose: