Install Pi-Hole as a Docker container using Portainer
Categories:
2 minute read
This will be installed as a container onto Docker running on an OpenMediaVault server
It also requires Portainer
Create a new Docker MACVLAN adapter
A Macvlan is a type of network driver in Docker that allows a container to be directly attached to a physical network interface on the host system. This provides the container with its own MAC address and allows it to appear as a separate physical device on the network.
Logon to the OpenMediaVault server using SSH and note down the name of the network adapter using on the LAN. Typically if wired this will be eth0
but double check.
ifconfig
Now, you need to determine the network design you’re system is running in. You’ll need the following data values
Data | Value |
---|---|
Network card name | eth0 |
Subnet | 192.169.1.0/24 |
Gateway | 192.168.1.254 |
New IP for Pi-Hole | 192.168.1.95/32 |
Network name | grinntec-net |
Execute this command in the SSH session substituting the values with your own.
sudo docker network create -d macvlan -o parent=`eth0` --subnet=`192.168.1.0/24` --gateway=`192.168.1.254` --ip-range=`192.168.1.95/32 grinntec-net`
Create Volumes
In Portainer
and the local Docker environment goto Volumes
and add two volumes:
etc-pihole
etc-dnsmasq.d
Create container
Under Containers
add a new Container
and give it a name of Pi-Hole
and for the Image
path enter pihole/pihole:latest
.
Add five Manual network port publishing
ports as below
Host | Container | Protocol |
---|---|---|
53 | 53 | UDP |
67 | 67 | UDp |
80 | 80 | TCP |
443 | 44 | TCP |
53 | 53 | TCP |
Under the Volunes
sections create two new volumne mounts.
Container | Type | Volume |
---|---|---|
/etc/pihole | Volunme | etc-pihole - local |
/etc/dnsmasq.d | Volumne | etc-dnsmasq.d - local |
Under the Network
section select the MACVLAN
adapater created earlier.
Under the Env
section add two new environment variables.
Name | Value |
---|---|
WEBPASSWORD | Enter a password that will be used to logon to the Pi-Hole service |
ServerIP | Enter the IP address you used on the MACVLAN setting |
Under the Restart Policy
section set it to Always
.
Under the Capabilities
enabled Net Admin
.
Click Deploy Container
Once the container is running you can logon to the web portal using the IP you configured on the MACVLAN.
References
How to Install Pi-Hole on OpenMediaValut