How to Install Pi-Hole on OpenMediaVault 5 inside Docker with Portainer using Raspberry Pi 4
In this segment we are going to show you how to configure “Pi-Hole on Docker with Portainer using OpenMediaVault 5 Raspberry Pi 4 “
What is OpenMediaVault ?
OpenMediaVault (OMV) is a free Linux distribution designed for network-attached storage (NAS). The project’s lead developer is Volker Theile, who instituted it in 2009. OMV is based on the Debian operating system, and is licensed through the GNU General Public License v3.
Source /> Wikipedia
What is Pi-Hole ?
Pi-hole is a Linux network-level advertisement and Internet tracker blocking application which acts as a DNS sinkhole (and optionally a DHCP server), intended for use on a private network. It is designed for use on embedded devices with network capability, such as the Raspberry Pi, but it can be used on other machines running Linux and cloud implementations. Pi-hole has the ability to block traditional website adverts as well as adverts in unconventional places, such as smart TVs and mobile operating system adverts.
OpenMediaVault Versions :
OpenMediaVault 5 Installation Guide :
Checkout official website : pi-hole
version: "3" # More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/ services: pihole: container_name: pihole image: pihole/pihole:latest ports: - "53:53/tcp" - "53:53/udp" - "67:67/udp" - "80:80/tcp" - "443:443/tcp" environment: TZ: 'Asia/Kolkata' # WEBPASSWORD: 'set a secure password here or it will be random' # Volumes store your data between container upgrades volumes: - './etc-pihole/:/etc/pihole/' - './etc-dnsmasq.d/:/etc/dnsmasq.d/' dns: - 127.0.0.1 - 22.214.171.124 # Recommended but not required (DHCP needs NET_ADMIN) # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities cap_add: - NET_ADMIN restart: unless-stopped
Note : Please change the OMV default port from 80 to something else.
Step 1 : Configuring Openmediavault Network Interface
- Firstly, we need to configure our DNS servers from Openmediavault Network Interface.
- Secondly, we need to navigate on Network –> Interfaces and edit the Network.
- Follwed by configure the DNS Server from Advanced settings to 127.0.0.1 or 126.96.36.199 as shown in Pi-Hole Docker-compose.
Step-2 : Create Macvlan Network for Pi-Hole
- Now we need to open Putty and enter our OpenMediaVault IP address.
- After that on the black screen login using root and enter the below given command to create Macvlan network for Pi-Hole.
- Change the subnet to your OpenMediaVault Ip address.
docker network create -d macvlan \ --subnet=192.168.1.10/24 \ --gateway=192.168.1.1 \ -o parent=eth0 pub_net
Step 3 : Download the Official Pi-Hole Docker image.
- After that pull the image we need to search for Pi-Hole container from the image box and chose the pihole/pihole:latest image.
- Followed by clicking on pull the image to download the latest pihole image.
Step 4 : Confogure Pi-Hole Image container
- Now, we need to navigate to Containers and then click on Add container.
- Then fill the details as mentioned below in the picture, Choose a name for your container and image name as pihole/pihole:latest.
- Important : Publish all exposed network ports to random host ports = Enable
- After that we need to navigate inside Advanced container settings and open volumes.
- First of all we need to create 2 folders on our Samba Server mentioned below.
- Inside volumes we need to click on map additional volume and then click on Bind to enter the container and host path.
- Volumes and Bind mounts Create folder 1 : pihole Create folder 2 : pihole/DNSmasq
Network : Select the Macvlan network that we have created Hostname : Create a Host Name for your Pi-Hole IPv4 Address : Type a IP Address for your Pi-Hole, Leave other options as it is.
-Environment variables ServerIP : "Type the Pi-Hole IP Address, which we created" TZ : "Asia/kolkata", Type your Time Zone WEBPASSWORD : "Password of your choice"
- For Restart Policy select Unless stopped.
- After that we need to click on Capabilities and then enable NET_ADMIN from the list.
- Once every thing is done we can go ahead and click on Deploy the container.
Finally you will be able to see this screen where Pi-Hole container is started.
Step 5 : Access Pi-Hole Server Web Interface
- To access the Pi-Hole web interface we need to type the Pi-Hole IP Address/admin.
- But our Pi-Hole is not yet ready for blocking Ads on our Network.
- To block the Ads on the Network we need to update Pi-Hole IP Address to our Router DNS.
http://Pi-Hole IP Address/admin/
Step 6 : Updating Pi-Hole IP Address to Router DNS
- Now, we need to Login to our Router and then Navigate to DNS Settings.
- Then we need to enter the Pi-Hole IP Address to our Router Primary DNS Address.
- After that, the traffic can route through the Raspberry Pi and Block ads with Pi-Hole.
Primary DNS Address : "Pi-Hole IP Address" Secondary DNS Address : "Cloudflare DNS Address i.e 188.8.131.52"
Step 7 : Reset Pi-Hole Password
- In case, if you forgot Pi-Hole password you can reset it anytime by using this command.
docker exec -it pihole pihole -a -p
In conclusion, you are all set to use Raspberry Pi 4 as Pi-Hole Network Wide Ad-Block Server.
If you face any issue regarding this article please share your thoughts.
Enjoy using Pi-Hole on Docker using Openmediavault.
Please checkout my other articles:
Did you Like my Work ?
Please Like, Share and Subscribe our YouTube Channel.