WebUI is no longer accessible in UnRaid Docker

Expected Behavior:

Access WebUI through dedicated IP or https://pi.hoe/admin.
All devices on the network to work with most sites without issue.

Actual Behavior:

Unable to access WebUI through dedicated IP or http://pi.hole/admin.
Apple devices aren't able to browse the web when Windows can.

Debug Token:

lhilo3xqt5

Running through docker.
I've run pihole -r to no help.
All of the errors/warnings I encounter are as follows.

> [βœ—] lighttpd daemon is inactive
> [βœ—] pihole-FTL daemon is inactive

> WARNING Misconfigured DNS in /etc/resolv.conf: Two DNS servers are recommended, 127.0.0.1 and any backup server
> WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1 (found 127.0.0.11)

All of this is still occurring after I've removed the image, deleted the file system starting, and restarted the server.

Other troubleshooting/research I have done on this fresh build.

> root@Unraid:~# sudo netstat -nltup | grep 'Proto\|:53 \|:5053 \|:5353 \|:8953 \|:67 \|:80 \|:471'
> Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
> tcp        0      0 192.168.122.1:53        0.0.0.0:*               LISTEN      9566/dnsmasq        
> tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      5749/nginx: master  
> tcp6       0      0 :::80                   :::*                    LISTEN      5749/nginx: master  
> udp        0      0 192.168.122.1:53        0.0.0.0:*                           9566/dnsmasq        
> udp        0      0 0.0.0.0:67              0.0.0.0:*                           9566/dnsmasq        
> udp        0      0 0.0.0.0:5353            0.0.0.0:*                           5694/avahi-daemon:  
> udp6       0      0 :::5353                 :::*                                5694/avahi-daemon:
> sudo service lighttpd status -1
> up (pid 10346) 3869 seconds
> sudo service pihole-FTL status -1
> up (pid 10369) 3889 seconds
> sudo service dnsmasq status -1
> s6 service not found for dnsmasq, exiting...
> root@Unraid:~# docker logs Pi-Hole
> [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... 
>  ::: Starting docker specific checks & setup for docker pihole/pihole
> WARNING Misconfigured DNS in /etc/resolv.conf: Two DNS servers are recommended, 127.0.0.1 and any backup server
> WARNING Misconfigured DNS in /etc/resolv.conf: Primary DNS should be 127.0.0.1 (found 127.0.0.11)
> 
> nameserver 127.0.0.11
> options ndots:0
>   [i] Existing PHP installation detected : PHP version 7.0.33-0+deb9u5
> 
>   [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
> ::: Pre existing WEBPASSWORD found
> Using custom DNS servers: 1.1.1.1 & 1.0.0.1
> DNSMasq binding to default interface: eth0
> Added ENV to php:
>                         "PHP_ERROR_LOG" => "/var/log/lighttpd/error.log",
>                         "ServerIP" => "192.168.1.199",
>                         "VIRTUAL_HOST" => "192.168.1.199",
> Using IPv4
> ::: Preexisting ad list /etc/pihole/adlists.list detected ((exiting setup_blocklists early))
> https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
> https://mirror1.malwaredomains.com/files/justdomains
> http://sysctl.org/cameleon/hosts
> 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
>   [i] Neutrino emissions detected...
>   [βœ“] Pulling blocklist source list into range
> 
>   [i] Target: raw.githubusercontent.com (hosts)
>   [βœ“] Status: Retrieval successful
> 
>   [i] Target: mirror1.malwaredomains.com (justdomains)
>   [βœ“] Status: No changes detected
> 
>   [i] Target: sysctl.org (hosts)
>   [βœ“] Status: No changes detected
> 
>   [i] Target: s3.amazonaws.com (simple_tracking.txt)
>   [βœ—] Status: Connection Refused
>   [βœ—] List download failed: using previously cached list
> 
>   [i] Target: s3.amazonaws.com (simple_ad.txt)
>   [βœ“] Status: No changes detected
> 
>   [i] Target: hosts-file.net (ad_servers.txt)
>   [βœ“] Status: No changes detected
> 
>   [βœ“] Consolidating blocklists
>   [βœ“] Extracting domains from blocklists
>   [i] Number of domains being pulled in by gravity: 138911
>   [βœ“] Removing duplicate domains
>   [i] Number of unique domains trapped in the Event Horizon: 116701
>   [i] Nothing to whitelist!
>   [i] Number of regex filters: 0
>   [βœ“] Parsing domains into hosts format
>   [βœ“] Cleaning up stray matter
> 
>   [βœ“] DNS service is running
>   [βœ“] Pi-hole blocking is Enabled
> [cont-init.d] 20-start.sh: exited 0.
> [cont-init.d] done.
> [services.d] starting services
> Starting crond
> Starting pihole-FTL (no-daemon) as root
> Starting lighttpd
> [services.d] done.
> Stopping lighttpd
> Starting lighttpd
> Stopping lighttpd
> Starting lighttpd
> Stopping pihole-FTL
> Starting pihole-FTL (no-daemon) as root

ngix took over port 80 and lighttpd is failing because of the port conflict.

You can edit the config file for lighttpd and move it to another port, then create a nginx rule that will forward requests to the new port.

Not familiarized with docker at all.

Pi-hole is relying to the /etc/resolv.conf to be set for 127.0.0.1 (or localhost).

Thanks for your help RamSet.

That makes sense, the thing that I don't know, or am aware of any way to find out what is using njinx or how to create a rule to forward requests to a new port.

I shut down all of my other docker containers and there is no change in experience.

it should be simple :slight_smile:
just load the IP in your browser. See what loads.

You can also check maybe the contents of /etc/nginx/sites-enabled/ will give you some insight.

A typical nginx config for a redirect for a request coming on port 80 would look like this:

server {
    listen 80;
    server_name  ACCESS.IP.GOES.HERE;

    root /var/www/html;

    location ~ /.well-known {
         allow all;
    }

    location / {
        proxy_pass http://127.0.0.1:CUSTOMPORT;
    }
}

This assuming Pi-hole is on the same host as the nginx.

file should be named ACCESS.IP.GOES.HERE.conf and it has to reside in /etc/nginx/sites-enabled/

Also a nginx restart is required fore the settings to apply.

I've tried port 80 on 192.168.1.101:80 (server), 192.168.1.199:80 (pi-hole), and 0.0.0.0:80 (just to be sure I wasn't missing something) and nothing returns. Networking and Linux is definitely my achilles heal. :confused: .

Also there isn't a njinx folder in /etc/ within the Pi-hole container.

Docker is mine :smiley:

I think if I could figure out what is using njinx, hopefully I'd be able to shut it down or alter the information.

Any ideas?

I got none ...
Meanwhile, see if editing the port information in /etc/lighttpd/lighttpd.conf and restarting lighttpd gets your /admin/ interface up (by using the IP:port address).

I can read files, but am not familiar in editing them outside of the docker template. The 80 port should be changed to 81 for Pi-hole, but I'm not able to confirm the change.

Here is the contents of /etc/lighttpd/lighttpd.conf

> # tail lighttpd.conf
> }
> 
> # Block . files from being served, such as .git, .github, .gitignore
> $HTTP["url"] =~ "^/admin/\.(.*)" {
>      url.access-deny = ("")
> }

Try cat /etc/lighttpd/lighttpd.conf | grep server.port

You can edit with any editor (easiest one being nano). Not sure this is available by default in the docker though.

Ahh. Port didn't change from 80.

Getting lost on this. This is what I was all I was able to do.

# sed 's/server.port 80/server.port 81/' lighttpd.conf
# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Lighttpd config for Pi-hole
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.

###############################################################################
#     FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE.     #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
#                                                                             #
#              CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE:              #
#                         /etc/lighttpd/external.conf                         #
###############################################################################

server.modules = (
        "mod_access",
        "mod_accesslog",
        "mod_auth",
        "mod_expire",
        "mod_compress",
        "mod_redirect",
        "mod_setenv",
        "mod_rewrite"
)

server.document-root        = "/var/www/html"
server.error-handler-404    = "/pihole/index.php"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80
accesslog.filename          = "/var/log/lighttpd/access.log"
accesslog.format            = "%{%s}t|%V|%r|%s|%b"

index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc", ".md", ".yml", ".ini" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

mimetype.assign   = ( ".png"  => "image/png",
                      ".jpg"  => "image/jpeg",
                      ".jpeg" => "image/jpeg",
                      ".html" => "text/html",
                      ".css" => "text/css; charset=utf-8",
                      ".js" => "application/javascript",
                      ".json" => "application/json",
                      ".txt"  => "text/plain",
                      ".svg"  => "image/svg+xml" )

# default listening port for IPv6 falls back to the IPv4 port

# Prevent Lighttpd from enabling Let's Encrypt SSL for every blocked domain
#include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
include_shell "find /etc/lighttpd/conf-enabled -name '*.conf' -a ! -name 'letsencrypt.conf' -printf 'include \"%p\"\n' 2>/dev/null"

# If the URL starts with /admin, it is the Web interface
$HTTP["url"] =~ "^/admin/" {
    # Create a response header for debugging using curl -I
    setenv.add-response-header = (
        "X-Pi-hole" => "The Pi-hole Web interface is working!",
        "X-Frame-Options" => "DENY"
    )

    $HTTP["url"] =~ ".ttf$" {
        # Allow Block Page access to local fonts
        setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
    }
}

# Block . files from being served, such as .git, .github, .gitignore
$HTTP["url"] =~ "^/admin/\.(.*)" {
     url.access-deny = ("")
}

# Add user chosen options held in external file
# This uses include_shell instead of an include wildcard for compatibility
include_shell "cat external.conf 2>/dev/null"
# cat /etc/lighttpd/lighttpd.conf | grep server.port
server.port                 = 80

Is this in docker? What is your docker run command or your docker-compose file? You just need to map port 81 to 80. docker run -p 81:80 or something along those lines.

It is in docker.

So as far as I know, a docker command can run through root, but not inside the Pi-hole container itself.

When I run docker run -p 81:80 in root.

root@Unraid:~# docker run -p 81:80
"docker run" requires at least 1 argument.
See 'docker run --help'.

Usage:  docker run [OPTIONS] IMAGE [COMMAND] [ARG...]

Run a command in a new container

The sample command I gave was to add to your existing docker run command. Where you have -p 80:80 you replace that with -p 81:80 and then use http://pi.hole:81/admin/ as the interface URL.

Oh, I think I see what you're saying.

Here is the the snippet. docker run ... -e 'TCP_PORT_80'='81'

And the full command.

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='Pi-Hole' --net='bond0' --ip='192.168.1.199' -e TZ="America/Denver" -e HOST_OS="Unraid" -e 'TCP_PORT_53'='53' -e 'UDP_PORT_53'='53' -e 'UDP_PORT_67'='67' -e 'TCP_PORT_80'='81' -e 'TCP_PORT_443'='443' -e 'DNS1'='1.1.1.1' -e 'DNS2'='1.0.0.1' -e 'TZ'='America/Denver' -e 'WEBPASSWORD'='iamunknown' -e 'INTERFACE'='eth0' -e 'ServerIP'='192.168.1.199' -e 'ServerIPv6'='' -e 'IPv6'='False' -e 'DNSMASQ_LISTENING'='all' -v '/mnt/cache/appdata/Pi-hole/pihole/':'/etc/pihole/':'rw' -v '/mnt/cache/appdata/Pi-hole/dnsmasq.d/':'/etc/dnsmasq.d/':'rw' --cap-add=NET_ADMIN --dns 127.0.0.1 --dns 1.1.1.1 --restart=unless-stopped 'pihole/pihole:latest'

WARNING: Localhost DNS setting (--dns=127.0.0.1) may fail in containers.
df352f8cb532bc41e96840b5333e7f88321d8269305b09ce8c176807e887b9c2

http://pi.hole:81/admin/ instantly times out. and server.port still shows as 80. I'm not sure if I'm able to change the 80 port on this distro even though it's one of the options.

Which template is it? I'll try and grab that to give it a look over.

Also, what does the docker page look like on the unraid Docker Containers page? Looking for the Port Mappings if they are displayed.

It's it's the spants repro.
image

That's the support for the template, note the first post says:

This docker need ports 53 (dns) and 80 (web) to work correctly. Change your Unraid admin port to 81 or use the new Docker IP functionality in unraid v6.4 to give it its own ip address.

I created a new conatiner with the below configuration, all works on port 81. The Command showing is:

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='pihole-template' --net='bridge' --log-opt max-size='50m' --log-opt max-file='1' -e TZ="America/Phoenix" -e HOST_OS="Unraid" -e 'DNS1'='8.8.8.8' -e 'DNS2'='8.8.4.4' -e 'TZ'='Europe/London' -e 'WEBPASSWORD'='admin' -e 'INTERFACE'='br0' -e 'ServerIP'='192.168.1.24' -e 'ServerIPv6'='' -e 'IPv6'='False' -e 'DNSMASQ_LISTENING'='all' -p '53:53/tcp' -p '53:53/udp' -p '67:67/udp' -p '81:80/tcp' -p '443:443/tcp' -v '/mnt/cache/appdata/pihole/pihole/':'/etc/pihole/':'rw' -v '/mnt/cache/appdata/pihole/dnsmasq.d/':'/etc/dnsmasq.d/':'rw' --cap-add=NET_ADMIN --dns 127.0.0.1 --dns 1.1.1.1 --restart=unless-stopped 'pihole/pihole:latest'

WARNING: Localhost DNS setting (--dns=127.0.0.1) may fail in containers.
8c02fbd148d4477d4da203fe25a0cb40dbcd2db4ef08108a58b1669bf13d6b15

I scrapped and removed the file system for pihole again as I see -e not -p when updating the template.

I followed this exactly as you did in only changing port 80 to 81, and now I come back with the command failing. Restarted the server to no avail.

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='pihole-template' --net='bridge' -e TZ="America/Denver" -e HOST_OS="Unraid" -e 'DNS1'='8.8.8.8' -e 'DNS2'='8.8.4.4' -e 'TZ'='Europe/London' -e 'WEBPASSWORD'='admin' -e 'INTERFACE'='br0' -e 'ServerIP'='192.168.1.199' -e 'ServerIPv6'='' -e 'IPv6'='False' -e 'DNSMASQ_LISTENING'='all' -p '53:53/tcp' -p '53:53/udp' -p '67:67/udp' -p '81:80/tcp' -p '443:443/tcp' -v '/mnt/cache/appdata/pihole/pihole/':'/etc/pihole/':'rw' -v '/mnt/cache/appdata/pihole/dnsmasq.d/':'/etc/dnsmasq.d/':'rw' --cap-add=NET_ADMIN --dns 127.0.0.1 --dns 1.1.1.1 --restart=unless-stopped 'pihole/pihole:latest'

WARNING: Localhost DNS setting (--dns=127.0.0.1) may fail in containers.
7b8f86e3ec0969ce56595ef8271838e8a737e38d1bbd54ad55566f74eaa65a1e
/usr/bin/docker: Error response from daemon: driver failed programming external connectivity on endpoint pihole-template (a55246178777a4ba3d645c4a2bf038f99e74fe4f48bf10cd5f0bb01acea6f6b6): Error starting userland proxy: listen udp 0.0.0.0:67: bind: address already in use.

The command failed.