💾 Archived View for tanso.net › notes › pihole-in-podman.gmi captured on 2024-06-20 at 12:19:05. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

Pi-hole in podman in Centos8

These were the steps I needed to perform to run pi-hole in a podman container on Centos8/RHEL8:

First I got it running in podman with the environment I needed (information on additional settings is available from https://hub.docker.com/r/pihole/pihole):

# podman run -d -p 53:53/udp -p 80:80/tcp \
    -e DNS1=1.1.1.1 -e DNS2=8.8.8.8 --name pi-hole \
    -e WEBPASSWORD=admin-password-here  \
    docker.io/pihole/pihole

Then I created a systemd service for it:

# cat <<'EOF' > /etc/systemd/system/pi-hole-container.service
[Unit]
Description=Pi-hole container

[Service]
Restart=always
ExecStart=/usr/bin/podman start -a pi-hole
ExecStop=/usr/bin/podman stop -t 2 pi-hole

[Install]
WantedBy=local.target
EOF

And finally killed my running container and verified that it got started from the systemd service:

# podman kill pi-hole
# systemctl enable pi-hole-container.service 
# systemctl start pi-hole-container.service

Then, when I need to upgrade it I do the following steps to save previous, and upgrade to latest:

# podman images|grep pihole
docker.io/pihole/pihole                   latest       14a0e4dc477d   9 months ago   312 MB

# podman tag 14a0e4dc477d pihole:previous
# podman pull docker.io/pihole/pihole

# systemctl stop pi-hole-container.service
# podman rm 06b4cb2224cf03f5ac40517574b4bd7c93946fea3f83ee3d09abb77f4e3d1ffb

### FIXME: how can I save this as rollback option, instead of deleting??

# podman run -d -p 53:53/udp -p 80:80/tcp \
    -e DNS1=1.1.1.1 -e DNS2=8.8.8.8 --name pi-hole \
    -e WEBPASSWORD=admin-password-here  \
    docker.io/pihole/pihole

# podman kill pi-hole
# systemctl start pi-hole-container.service

Back to /