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 (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

OpenMediaVault

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 can block traditional website adverts as well as adverts in unconventional places, such as smart TVs and mobile operating system adverts.

pihole

OpenMediaVault Versions :

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

You can Buy Raspberry Pi 4 Kit from here

 

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:

OpenMediaVault 5 on Raspberry Pi

How to install OpenMediaVault 5 on Raspberry Pi All Models

OpenMediaVault 5 on Raspberry Pi

OpenMediaVault 5 NAS Server on Raspberry Pi 4

Did you find us helpful?

Subscribe our YouTube Channel
Like us on Facebook facebook
Support us on Patreon Patreon
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.

Leave a Reply