PiHole as a container

Root:

Set IP/net Then:

Get root access:

sudo apt update && apt dist-upgrade #Update System

sudo apt install podman #Install Podman

sudo echo 'net.ipv4.ip_unprivileged_port_start=0' >> /etc/sysctl.conf # Allow non root users to use ports bellow 1024

sysctl -w net.ipv4.ip_unprivileged_port_start=0

User:

podman pull docker.io/pihole/pihole:latest #get pihole image

mkdir -p /home/student/my.hole/pihole/ #Set permanent config folder for pihole

mkdir -p /home/student/my.hole/dnsmasq.d/ #Set permanent config folder for dnsmasq

podman run -d --name my.hole -p 53:53/tcp -p 53:53/udp -p 80:80 -e TZ="Europe/Lisbon" -e FTLCONF_webserver_api_password=myhole -v /home/student/my.hole/pihole/:/etc/pihole:Z -v /home/student/my.hole/dnsmasq.d/:/etc/dnsmasq.d:Z --restart unless-stopped --hostname my.hole docker.io/pihole/pihole:latest #boot pi hole

PS:

my.hole folder, my.hole container name, myhole password , student are my own custom names. You are free o use them or create your own.

A full copy paste should work in full.

Run as Service:

mkdir -p ~/.config/systemd/user

cd .config/systemd/user/

podman generate systemd --name my.hole --files

podman stop my.hole

systemctl --user daemon-reload

systemctl --user enable --now container-my.hole

systemctl --user status container-my.hole.service

loginctl enable-linger

Test

Lists:

https://big.oisd.nl

https://raw.githubusercontent.com/r0xd4n3t/pihole-adblock-lists/main/pihole_adlists.txt