pi-hole / docker-pi-hole

Pi-hole in a docker container
https://pi-hole.net
Other
8.58k stars 1.13k forks source link

"DNS Resolution is currently unavailable" #489

Closed callahan22 closed 5 years ago

callahan22 commented 5 years ago

Description

New test Ubuntu server with docker installed on it. All the prereqs done, i.e.

sudo apt-get install network-manager
sudo docker pull pihole/pihole:latest
sudo systemctl disable systemd-resolved.service
sudo service systemd-resolved stop
sudo nano /etc/NetworkManager/NetworkManager.conf

[main]
plugins=ifupdown,keyfile
dns=default

sudo mv /etc/resolv.conf /etc/resolv.conf.bak
sudo service network-manager restart

I set up my docker-compose as follows (it's a limited config but the idea is to build out as (if) it starts to work):

 pihole:
    container_name: pihole
    hostname: pihole
    image: pihole/pihole:latest
    ports:
      - '53:53/tcp'
      - '53:53/udp'
      # - '67:67/udp'
      - '80:80/tcp'
      - '443:443/tcp'
    restart: unless-stopped
    volumes:
      - ./docker/pihole/pihole:/etc/pihole
      - ./docker/pihole/pihole.log:/var/log/pihole.log
      - ./docker/pihole/dnsmasq.d:/etc/dnsmasq.d
    cap_add:
      - NET_ADMIN
    environment:
      - ServerIP=192.168.1.7
      - TZ=Europe/London
      - WEBPASSWORD=password
      - DNS1=127.0.0.1
      - DNS2=1.1.1.1
sudo docker-compose up -d
Creating pihole ... done

Web backend is unresponsive, so:

sudo docker logs pihole

[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] 01-resolver-resolv: applying...
[fix-attrs.d] 01-resolver-resolv: exited 0.
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] 20-start.sh: executing...
stty: 'standard input': Inappropriate ioctl for device
 ::: Starting docker specific checks & setup for docker pihole/pihole
**WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1 (found 192.168.1.15)**

# This file is managed by man:systemd-resolved(8). Do not edit.
#
# This is a dynamic resolv.conf file for connecting local clients directly to
# all known uplink DNS servers. This file lists all configured search domains.
#
# Third party programs must not access this file directly, but only through the
# symlink at /etc/resolv.conf. To manage man:resolv.conf(5) in a different way,
# replace this symlink by a static file or a different symlink.
#
# See man:systemd-resolved.service(8) for details about the supported modes of
# operation for /etc/resolv.conf.

nameserver 192.168.1.15
nameserver 8.8.8.8
nameserver 192.168.1.11
# Too many DNS servers configured, the following entries may be ignored.
nameserver 192.168.1.1
search mydomain.net
stty: 'standard input': Inappropriate ioctl for device
  [i] Existing PHP installation detected : PHP version 7.0.33-0+deb9u3

  [i] Installing configs from /etc/.pihole...
  [i] Existing dnsmasq.conf found... it is not a Pi-hole file, leaving alone!
  [✓] Copying 01-pihole.conf to /etc/dnsmasq.d/01-pihole.conf
chown: cannot access '/etc/pihole/dhcp.leases': No such file or directory
Setting password: password
+ pihole -a -p password password
  [✓] New password set
Using custom DNS servers: 1.1.1.1 & 8.8.4.4
DNSMasq binding to default interface: eth0
Added ENV to php:
            "PHP_ERROR_LOG" => "/var/log/lighttpd/error.log",
            "ServerIP" => "192.168.1.7",
            "VIRTUAL_HOST" => "192.168.1.7",
Using IPv4 and IPv6
::: setup_blocklists now setting default blocklists up:
::: TIP: Use a docker volume for /etc/pihole/adlists.list if you want to customize for first boot
::: Blocklists (/etc/pihole/adlists.list) now set to:
https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
https://mirror1.malwaredomains.com/files/justdomains
http://sysctl.org/cameleon/hosts
https://zeustracker.abuse.ch/blocklist.php?download=domainblocklist
https://s3.amazonaws.com/lists.disconnect.me/simple_tracking.txt
https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt
https://hosts-file.net/ad_servers.txt
::: Testing pihole-FTL DNS: FTL started!
::: Testing lighttpd config: Syntax OK
::: All config checks passed, cleared for startup ...
 ::: Docker start setup complete
  [i] Pi-hole blocking is enabled
  [✗] DNS resolution is currently unavailable

I can see the error message: WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1 (found 192.168.1.15)

What I don't understand is why it's not taking the DNS servers I assign it in the environment variables? Those DNS servers are all valid bar one (192.168.1.11). The only place that old DNS server is listed is in my AD DNS but how/why is this container getting all the way to my DNS internally when I've only told it about itself and 1.1.1.1? I'm obviously missing something (obvious?) so if anyone fancies pointing out where I'm going wrong, I'd appreciate it!

Your Environment

callahan22 commented 5 years ago

Of all things, a reboot was what it needed. I was clearly over thinking things and ignoring the most obvious.....