Pi-Hole on OpenMediaVault with Docker and Portainer by Easy Way

In this segment, we are going to demonstrate “how to set up your Pi-Hole on OpenMediaVault in a really simple technique.

What is OpenMediaVault?

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.

What is Pi-Hole?

Pi-hole is a Linux network-level advertisement and Internet tracker blocking application that 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 can block traditional website adverts as well as adverts in unconventional places, such as smart TVs and mobile operating system adverts.

pihole

Source /> Wikipedia

OpenMediaVault Versions :

Equipment Required Optional
Raspberry Pi Raspberry Pi 4 Case
SD_Card
SD Card Raspberry Pi Keyboard
Ethernet Ethernet Cable Mouse
Charger Power Adapter    
HDD External HDD    
Shop now

Pi-Hole

Checkout official website: pi-hole

Docker-compose

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
      - 1.1.1.1
    # 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 and then start with

sudo apt update
sudo apt dist-upgrade

In our last tutorial, we have shown you how we have set up Pi-Hole with a Dedicated IP Address on OpenMediaVault. But this time we are going to use OMV IP Address to configure Pi-Hole

  • By using this method we can easily eliminate lots of steps and resolve plenty of mess for everyone.

Issues faced in the Last Build.

The container stopped working after some time.

Pi-Hole won’t start after a System reboot or Container restart.

  • To resolve all these issue lets begin installing Pi-Hole.

Step 1: Download the Official Pi-Hole Docker image

  • To download the Pi-Hole image we need to click on the images section from the right panel and then pull the latest image from pihole/pihole:latest.
  • Followed by clicking on pull the image to download the latest pihole image.
OpenMediaVault

Step 2: Add the Pi-Hole Container

  • After that, we need to move to containers from the right side of the screen and click on add container. Then we need to enter the name for our image, PiHole, and select the Pi-Hole image.
  • Now we need to Publish five new ports as mentioned in Docker-compose.
Pihole
  • To resolve the Port 53 bind issue, you need to use the below-given commands.
sudo systemctl disable systemd-resolved.service
sudo systemctl stop systemd-resolved

Step 3: Add container path and Bind the host volumes

  • Once all the ports configured successfully then we need to navigate to volume and create these volumes as mentioned below.pihole

Step 4: Configure the network for Pi-Hole

  • Followed by navigating on to the network and Leave it in bridge mode. After that type a Hostname for your Pi-Hole and type Primary DNS Serer and Secondary DNS server as mentioned below.
pihole

Step 5: Configure the Environment variable

  • In this step, we need to add three Environment Variable as mention below. Please change the values according to your requirements.
Pihole
  • Followed by clicking on Restart Policy and select Unless stopped.

Step 6: Access Pi-Hole Server Web Interface

  • To access the Pi-Hole web interface we need to type the OpenMediaVault 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 OpenMediaVault IP Address to our Router DNS.
Pi-Hole
http://OpenMediaVault IP Address/admin/

Step 7: Updating Pi-Hole IP Address to Router DNS

  • Now, we need to log in to our Router and then Navigate to DNS Settings.
  • Followed by, entering the OpenMediaVault 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   : "OpenMediaVault IP Address"
Secondary DNS Address : "Cloudflare DNS Address i.e 1.1.1.1"
router DNS

Step 8: Reset Pi-Hole Password

  • In case, if you forgot the 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.
  • Smile (.”_”.)

Please check out my other articles:

Did you find us helpful?

Subscribe our YouTube Channel YouTube
Support us on Patreon Patreon
Like us on Facebook facebook
Share This Article with others

Harish Kumar

As a founder of the PcMac YouTube channel and website, Our goal is to provide Free Technical help to people and spread knowledge to everyone.
0 0 votes
Article Rating
Subscribe
Notify of
guest
6 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Mechrekt
Mechrekt
4 years ago

Hi, thank you for this guide! I have 2 questions.
1) I set my router to give pihole ip as dns server to the clients into dhcp settings. Do I have to set also the pihole ip to the router itself for its connection to internet? I noticed that we configure pihole to have “real” dns, like 1.1.1.1 to go to internet, so it could be correct.
2) We are using pihole:latest image, but how and when happens the update to be sure to have always the latest version? It is automatic? Maybe this is a general question, applicable to all dockers.

Thank you again.

Cheong
Cheong
4 years ago

Hi Harish,
Many thanks for your guide. It has helped me a lot. I followed your youtube steps and could get it working after I ran the steps to resolve port 53 bind issue.
Can I please ask a question? I did not do Step 3 above (Add container path and Bind the host volumes) but everything seems to be working (I can see it blocking domains, I can load more sites to blacklist, I can add whitelist etc.).
Qn: Do I need to do step 3? And what would happen if I did not do it? Thanks in advance. Ha, ha. Reason that I did not do step 3 is that I am still not sure how to do it.
Thank you.

Kind regards,
Cheong

Dominik
Dominik
3 years ago

Thank you!! I got through 4 Tutorials to install pihole via portainer on omv. This is the first that worked! Thanks a lot!!

CyberZer0
CyberZer0
3 years ago

How you handle IPv6? All is working fine with IPv4… But most of the sites are loading via IPv6. Thanks, Great Tutorial!