In this post, I’m installing PiHole on a RPi. You will need Docker on your Rpi (there is a post here about it).

– Create a directory for the application

mkdir ~/apps/pihole

– Create a start-up script in that directory:

cd ~/apps/pihole

– Paste the following script (replace the TZ and WEBPASSWORD values):


docker pull pihole/pihole:latest
docker container stop pihole
docker rm pihole

docker run -d \
    --name pihole \
    -p 53:53/tcp -p 53:53/udp \
    -p 80:80 -p 67:67/udp \
    -p 443:443 \
    -e TZ="Asia/Bangkok" \
    -e WEBPASSWORD="piholeadmin" \
    -v "$(pwd)/etc-pihole/:/etc/pihole/" \
    -v "$(pwd)/etc-dnsmasq.d/:/etc/dnsmasq.d/" \
    --dns= --dns= \
    --restart=unless-stopped \

printf 'Starting up pihole container '
for i in $(seq 1 20); do
    if [ "$(docker inspect -f "{{.State.Health.Status}}" pihole)" == "healthy" ] ; then
        printf ' OK'
        echo -e "\n$(docker logs pihole 2> /dev/null | grep 'password:') for your pi-hole: https://${IP}/admin/"
        exit 0
        sleep 3
        printf '.'

    if [ $i -eq 20 ] ; then
        echo -e "\nTimed out waiting for Pi-hole start start, consult check your container"
        echo -e "logs for more info (\`docker logs pihole\`)"
        exit 1

Make it executable

chmod u+x

– Stop and disable `systemd-resolved.service`:

sudo systemctl stop systemd-resolved
sudo systemctl disable systemd-resolved

– Reset `/etc/resolv.conf`:

sudo rm /etc/resolv.conf
echo "nameserver" | sudo tee /etc/resolv.conf
echo "nameserver" | sudo tee -a /etc/resolv.conf

– Then start it:


– You can browse and login on http://<rpi-ip-address>/admin
That’s all needed. Enjoy!