Hello, friends. In this post, you will learn how to install and deploy Pi-Hole using Docker. This way you will have another valid alternative to enjoy this great tool.
Introducing to Pi-hole
Pi-Hole is a network-level Adblock, that is, instead of having to be installed on every browser on every device in a network, it is “at the same level as the router”. This implies that any device connected to the network will then take advantage of having Pi-Hole.
Of course, Pi-Hole is installable on many Linux distributions because of its very good support. In addition, we have several ways to install it although in this post we will address the Docker alternative.
With Docker, we will be able to deploy Pi-Hole in almost any Linux distribution and besides this, take advantage of all the benefits that Docker gives us as the management and security of the isolation with the system.
That’s why, in this post, you will learn how to deploy Pi-Hole using Docker.
Deploy Pi-Hole using Docker
For this post, I have chosen Debian 11 because it is one of the systems I trust the most.
So, first, install Docker on Debian 11. For that, we have our post
How to install Docker on Debian 11?
After Docker is fully functional on the system, it is then convenient to download the necessary tools so that Pi-Hole can be deployed.
To do this, with the help of git
run
git clone https://github.com/pi-hole/docker-pi-hole.git
In case you do not have git
on your system, then you can install it as follows
sudo apt install git
This will create a folder called docker-pi-hole
which is where we will have all the necessary files.
Access this folder.
cd docker-pi-hole/
Inside it, we have the docker_run.sh
file which is where the script that actually installs Pi-Hole is.
Before executing it, it is convenient to take a look at it first.
nano docker_run.sh
Because in this file you can edit the DNS that by default are 127.0.0.1
and 1.1.1.1.1
as shown in the image.
Save the changes and close the editor.
Now when you are ready, you can run it
sh docker_run.sh
If everything went well, a message should appear on the output screen indicating this.
To access the Pi-hole panel you have to open a web browser and access http://ip-server/admin
and you will see the following screen
This way, you will know that Pi-Hole is ready for battle. The next thing to do is to configure your router so that the DNS is that of Pi-Hole.
Enjoy it
Conclusion
In this post, you have learned how to deploy Pi-Hole using Docker for our purpose. This way you have another way to deploy it.
I get errors:
~/docker-pi-hole$ sh docker_run.sh
docker_run.sh: 6: [[: not found
docker_run.sh: 9: docker: not found
Starting up pihole container docker_run.sh: 26: docker: not found
docker_run.sh: 26: [: unexpected operator
.docker_run.sh: 26: docker: not found
docker_run.sh: 26: [: unexpected operator
………………….
………
apt-install docker
well, I took port 443, because port 80 is engaged.
DNS: –dns=195.50.140.114 –dns=195.50.140.252 \
Server IP: 92.78.XX.XX
after running ./docker_run.sh I get:
Starting up pihole container ………. OK
Assigning random password: s3U58qxx for your pi-hole: https:///admin/
404, or webpage not found
Gave a dnsmasq error, acted like I already have dnsmasq installed, but I don’t, it’s a fresh install.
Also, can connect browser to pihole, but can’t login, it never gave a password.
Also, no user “pihole” exists, to manually set password.
Try username :
pi
instead of pihole
Starting up pihole container docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: starting: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.docker_run.sh: 26: [: healthy: unexpected operator
.-e
Timed out waiting for Pi-hole start, consult your container logs for more info ( `docker logs pihole`)