Install Pi-hole with Docker on Phicomm N1

2 minute read

Install required packages

$ sudo apt install docker.io -y
$ sudo apt install docker-compose -y
$ sudo apt install lighttpd -y

$ docker -v
Docker version 19.03.12, build 48a6621
$ docker-compose -v
docker-compose version 1.25.0, build unknown

Get the docker-compose.yml and Dockerfile from github:

mkdir ~/pihole
cd ~/pihole
wget https://raw.githubusercontent.com/pi-hole/docker-pi-hole/master/Dockerfile_arm64
wget https://raw.githubusercontent.com/pi-hole/docker-pi-hole/master/docker-compose.yml

Start Pi-hole

Add privileged: true to docker-compose.yml, then start pihole with:

docker-compose up [-d]

Some useful commands

$ docker ps -a
CONTAINER ID        IMAGE                  COMMAND             CREATED             STATUS                      PORTS               NAMES
9c8d37afa3ca        pihole/pihole:latest   "/s6-init"          40 minutes ago      Exited (0) 25 minutes ago                       pihole
$ docker rm 9c8d37afa3ca
$ docker-compose up -d
$ docker-compose stop
$ docker exec -it 9c8d37afa3ca pihole -a -p

Troubleshooting

Couldn’t connect to Docker daemon at …

$ docker-compose up
ERROR: Couldn't connect to Docker daemon at http+docker://localhost - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

This issue occurs when current user is not in docker group, add user to docker with:

sudo usermod -aG docker $(whoami)
sudo reboot

couldn’t get ‘max filedescriptors’ Operation not permitted

pihole    | Starting lighttpd
pihole    | 2020-08-04 23:02:52: (server.c.970) couldn't get 'max filedescriptors' Operation not permitted
pihole    | Stopping lighttpd

There is an open issue, and the not-perfect solution is add privileged: true to docker-compose.yml.

Cannot start service pihole

$ docker-compose up
Starting pihole ...
Starting pihole ... error

ERROR: for pihole  Cannot start service pihole: driver failed programming external connectivity on endpoint pihole (5007f19e6f90a789b3c56fe2e95235ac70533b4b528d80e10f5a2410fb3afd5d): Error starting userland proxy: listen tcp 0.0.0.0:80: bind: address already in use

Service lighttpd was started after installation, and listening to port 80, it conflicts with pihole, so stop it, pihole will start it automatically:

$ sudo service lighttpd stop

Web interface not accessible

The web interface only working after pi-hole completed started, if you see the these logs, it should work:

pihole    | [services.d] starting services
pihole    | Starting crond
pihole    | Starting lighttpd
pihole    | Starting pihole-FTL (no-daemon) as root
pihole    | [services.d] done.

This step may take very long time to complete, be patient:

  [✓] Update local cache of available packages

See full log here

Wrong password when login to admin web page

I use the random password found by docker logs pihole | grep random to login to admin account, but failed with Wrong password.

If you see below log in the output of docker-compose up:

pihole    | ::: Pre existing WEBPASSWORD found

Then you may have this issue, try to remove the line starting with WEBPASSWORD in file ~/pihole/etc-pihole/setupVars.conf

Run docker-compose up again, you will see new password was generated:

pihole    | + pihole -a -p 8_NorGN6 8_NorGN6
pihole    | Setting password: 8_NorGN6
pihole    |   [✓] New password set

See this comment in issue 428.