Run Pi-Hole in localhost and some extras

Install Docker, Docker-Compose

Debian Based

sudo apt update
sudo apt upgrade -y
sudo apt install docker
sudo apt install docker-compose
sudo usermod -aG docker $USER
sudo systemctl enable docker
sudo systemctl start docker
# Log Out from session or restart to add user to the user-group

Arch Based

sudo pacman -Syu
sudo pacman -S docker
sudo pacman -S docker-compose
sudo usermod -aG docker $USER
sudo systemctl enable docker
sudo systemctl start docker
# Log Out from session or restart to add user to the user-group

Portainer Installation

docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name portainer \
--restart=always \
-v /var/run/docker.sock:/var/run/docker.sock \
-v portainer_data:/data \
portainer/portainer-ce:2.9.3

Pi-Hole container

version: "3"
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
ports:
- "53:53/tcp"
- "53:53/udp"
- "67:67/udp"
- "8081:80/tcp"
env_file:
- .env
environment:
TZ: 'Europe/Berlin' # Change that with your timezone
WEBPASSWORD: 'ThisIsaPlaceholder'
volumes:
- './etc-pihole/:/etc/pihole/'
- './etc-dnsmasq.d/:/etc/dnsmasq.d/'
dns:
- 127.0.0.1
- 1.1.1.1
cap_add:
- NET_ADMIN
restart: unless-stopped

Change the network DNS

More you can do with Pi-Hole

Nginx Proxy Manager container

version: '3'volumes:
npm-data:
npm-ssl:
npm-db:
networks:
frontend:
backend:
services:
npm-app:
image: jc21/nginx-proxy-manager:latest
restart: always
ports:
- "80:80"
- "81:81"
- "443:443"
environment:
- DB_MYSQL_HOST=npm-db
- DB_MYSQL_PORT=3306
- DB_MYSQL_USER=npm
- DB_MYSQL_PASSWORD=replace-with-secure-password
- DB_MYSQL_NAME=npm
volumes:
- npm-data:/data
- npm-ssl:/etc/letsencrypt
- /opt/websites:/mnt/user/appdata/NginxProxyManager/websites
networks:
- frontend
- backend
npm-db:
image: jc21/mariadb-aria:latest
restart: always
environment:
- MYSQL_ROOT_PASSWORD=replace-with-secure-password
- MYSQL_DATABASE=npm
- MYSQL_USER=npm
- MYSQL_PASSWORD=replace-with-secure-password
volumes:
- npm-db:/var/lib/mysql
networks:
- backend

Setup local domains and reverse proxy

Conclusion

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store