Pi Hole Docker

Pi Hole Docker




🔞 ALL INFORMATION CLICK HERE 👈🏻👈🏻👈🏻

































Pi Hole Docker
Cookies Settings Reject All Accept All Cookies
By clicking “Accept All Cookies”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts.


Creating two Docker Volumes for the Pi-hole Configurations.

Seeing the Pi-hole Docker Container Running Properly.

Viewing Pi-hole dashboard Default Page.

Accessing Network & Internet Settings

Accessing Network Adapter Properties.

Configuring DNS server on smartphone

Running Docker Pi-hole in Action with a Smartphone Usage for 5-10 Minutes

Manually setting a router DNS settings.

Showing Update Gravity on Pi-hole UI after Copying Additional Website Blacklists on Text File

Adding a Community-Maintained Blacklists of URLs for Pi-hole to Block

Copyright 2022© ATA Learning | Privacy Policy



Don't be left behind with the ATA Learning Newsletter!








Published: 6 October 2021 - 8 min. read

Read more
tutorials by Helen Mary Barrameda!
Perhaps you are pestered by pop-up ads whenever reading an article on a website. With all those ads, how to block them? Install Pi-hole in Docker, and use Pi-hole as a network-wide ad blocker and improve your network performance.
In this tutorial, you’ll learn how to set up and run Pi-hole in a Docker container to block ads and websites. Sound exciting? Read on to learn more!
This tutorial will be a hands-on demonstration. If you’d like to follow along, be sure you have the following:
When setting up Pi-hole in Docker container, you’ll first need to create a Docker volume to store the Pi-hole application and DNS configuration.
Open PowerShell as administrator , then run the below commands for Docker to create two volumes ( volume create ) named pihole_app and dns_config . You can also change the names according to your preference.
Next, verify that the Docker volumes have been created successfully by running the following command which lists all Docker volumes available on your machine.
Below, you see two newly created volumes named pihole_app and dns_config .
Now that you have two persistent volumes available, you are ready to run a Docker container using Pi-hole’s base Docker image. But first, you’ll need to note your local IP address.
Run the below command to get your local IP address. Your local IP address is necessary to run the single Docker command properly.
Next, run the command below to pull the pihole/pihole base image from Docker hub. Replace the values accordingly using the table below as your reference. The table below explains each flag of the command’s purpose.
Below, you can see the command pulls the pihole/pihole base image from Docker Hub . Once the pihole/pihole image is downloaded on your machine, the command automatically continues and follows the parameters you set in the command.
After pulling the pihole/pihole base image, you’ll see an output like the one below, which indicates that you can already run the Pi-hole dashboard from the container.
Once the Docker container you created is running, you can now access the Pi-hole dashboard. The Pi-hole dashboard is a graphical interface that allows you to configure which ads to block either via your own blacklist or community-maintained blacklists.
Navigate to http://localhost:81 on your browser since you previously mapped port 81 of the host machine to port 80 of Docker container. In doing so, your web browser redirects the page to the Pi-hole dashboard.
If you set a different port when running the previous docker command, change the port to access the Pi-hole dashboard. For example, http://localhost:n where ‘n’ represents the port number.
Now, log in to the Pi-hole dashboard with the password you set by running the docker command in the “Running Pi-hole Docker Container with Environment Variables” section. For this tutorial, the password is “password” (without quotes).
As you see below, the Pi-hole container is not actively blocking ads and is on standby mode waiting for what it calls “queries” or ad requests to evaluate.
With the Pi-hole server running, how do you start blocking ads on your local system? You need to tell your local system to route all requests to the Pi-hole IP address and block any matched ads. Read on to learn how!
1. Right-click on your network settings icon in the Windows system tray and choose Open Network & Internet Settings to see the list of all network adapters in your machine.
2. Next, right-click on your network adapter and choose Properties . Your network adapter’s settings window will pop up.
3. Select Internet Protocol Version 4 (TCP/IPv4) from the list under the Networking tab, then click on the Properties button.
4. Configure the IPv4 properties with the following:
Assuming you have a smartphone or any other device connected to the same network, you can point the DNS server of that device to match the host’s IP address. In this tutorial, a smartphone is connected to the same network.
1. In the smartphone’s wireless network settings, tap on Manual and input the IP address of the host machine. You can also add alternative IP addresses in case Pi-hole fails.
Wireless network settings interface on smartphones differ from one another.
2. Now visit some websites that are heavy on ads in your smartphone’s web browser.
For this example, the websites of Daily Mail and the New York Times were visited repeatedly for 5-10 minutes. The live browser admin on the Pi-hole dashboard shows the number of blocked ads from the device, as shown below.
The bar charts are a recent addition to Pi-hole’s latest version at the time of this writing. Some older versions have line charts instead.
Rather than configuring a DNS server on a single device, try configuring DNS servers for all devices in your router settings. Depending on your router, there may or may not be a provision for using the IP address.
For this demo, the router did not allow access to changing DNS servers and DHCP. So home networking was not explored in full detail in this tutorial due to router constraints.
In a sample admin view, you may be able to encode the DNS server IP in the same way as it was done in a single device. This demo uses a Prolink PRS1841U-v2 router locked to ISP.
The DNS configuration interface differs from router to router, but the settings look like the one below.
You can also disable the DHCP server in the router and then enable the DHCP server in Pi-hole instead. A sample discussion in the Pi-hole community shows this in more detail.
The default installation of Pi-hole blocks around 92,725 websites by default, but you can also add more websites via blacklists from the Pi-hole maker and other lists shared by Pi-hole fans .
1. Save the websites to block in a text file with your preferred name. For this example, the file is named blocklist.txt .
2. Run the docker command below to copy the blocklist.txt file ( cp blocklist.txt ) to the Docker container’s volume in a file named blacklist.txt . Keep the blacklist.txt file on the Docker volume so that Pi-hole will detect it automatically.
3. Finally, navigate to the Pi-hole admin dashboard again. Click the Tools menu in the left panel and then the Update Gravity link. Finally, click Update to retrieve an updated list of URLs for Pi-hole to block.
A successful update will look like the one below.
Perhaps you prefer to run console commands rather than navigating the Pi-hole dashboard. If so, you can run a docker command in PowerShell to block websites. Run the docker exec command below to create an interactive terminal session to the pihole_app Docker container, which allows the running of commands.
Once the terminal session is open run the command below to update Pi-hole’s blacklist of URLs.
Re-run pihole -g from time to time so that your ad blocker will stay updated.
Some URLs are dedicated to being updated regularly by their contributors, and some are not, so uploading a blacklist from an old list may not reflect the latest changes.
Leverage the Adlist block list group management feature of Pi-hole. On the Pi-hole dashboard, click on the Group Management → Adlists menu at the left panel, then click on Add to choose the list of URLs you want to add in Pi-hole.
In this tutorial, you learned how to download a Pi-Hole Docker image, test out an active listening Pi-hole web interface, test an external device to connect to Pi-hole. You’ve also learned how to block ads and websites, that you’ve seen the Pi-hole dashboard in action as it blocks them.
With this knowledge, why not use any host machine to block ads to other connected devices in the same network?
Hate ads? Want to support the writer? Get many of our tutorials packaged as an ATA Guidebook.
Recommended Resources for Training, Information Security, Automation, and more!
ATA Learning is always seeking instructors of all experience levels. Regardless if you’re a junior admin or system architect, you have something to share. Why not write on a platform with an existing audience and share your knowledge with the world?
ATA Learning is known for its high-quality written tutorials in the form of blog posts. Support ATA Learning with ATA Guidebook PDF eBooks available offline and with no ads!
Learn how to create your first Windows Docker image from a Dockerfile using the docker build command for container images.
Learn how to deploy and run your first Azure Container Instance, based on a sample ASP.NET container image.
Tired of maintaining separate environments for your development and testing needs? Why not try the WSL Docker combination in Windows so you only need one? Learn how to setup Docker in WSL in this step-by-step article.
Names a Docker container as pihole. There will be an error if a container with the same name already exists on your machine
Environment variable for time zone. Asia/Manila was used for this tutorial, but you can input anything that has the same format listed in on a GitHub gist .
Sets a password for the Pi-hole interface.
Set your IP address for the Docker container. You will use this again later for making Pi-hole work.
Mounts the volume pihole_app and use subdirectory /etc/pihole for storing the Pi-hole files
Mounts the volume dns_config and use subdirectory /etc/dnsmasq. d for storing DNS configurations as required.
Maps the ports of host machine to the ports of the Docker container (port 81 in host machine maps to port 80 of Docker container)
Sets a restart policy so the Docker container always restarts unless it is manually stopped by the user.
Tells the docker run command to use the official pihole/pihole base image from Docker hub.

You can run Pi-hole in a container, or deploy it directly to a supported operating system via our automated installer.
Our intelligent, automated installer asks you a few questions and then sets everything up for you. Once complete, move onto step 3.
Configure your router’s DHCP options to force clients to use Pi-hole as their DNS server, or manually configure each device​ to use the Pi-hole as their DNS server.
By pairing your Pi-hole with a VPN, you can have ad blocking on your cellular devices, helping with limited bandwidth data plans.
Instead of browser plugins or other software on each computer, install Pi-hole in one place and your entire network is protected.
Network-level blocking allows you to block ads in non-traditional places such as mobile apps and smart TVs, regardless of hardware or OS.
Since advertisements are blocked before they are downloaded , network performance is improved and will feel faster.
Our Web interface offers control of your Pi-hole and a central place to view statistics. We also include an API for extending these stats.
The Pi-hole developers are spread across the globe and work on the project in their spare time. We are a 100% remote team.
In addition to blocking advertisements, Pi-hole has an informative Web interface that shows stats on all the domains being queried on your network.
Pi-hole works fine with an existing DHCP server, but you can use Pi-hole’s to keep your network management in one place.
Fine tune your experience by blacklisting or whitlisting domains. Extend this capability with powerful regex statements.
See all the domains being queried on your network, where they originated, and more.
Queries are stored in a database and can be queried at any time. Learn about what’s happening on your network over time.
Keep track of the most queried domains and add them to a white or blacklist from a central page.
Choose from four different privacy modes that works for your environment.
Control and configure other settings from the Web interface.


Recent Posts


How to Install Mealie using Docker


Painlessly Install Docker on a Synology NAS


How to Install Adguard Home using Docker


How to Install Bookstack using Docker


How to Install Ombi using Docker




Categories

Games

News

Reviews

Self-Hosted

Tutorials




Navigation

Contact
Privacy Policy
Write for Us



Internet advertisements and trackers are everywhere. The websites you visit and your smart devices are constantly sending data to back to their manufacturers and to third party advertisers. Pi-hole is a network-level ad blocker that sits on your network and uses blacklists to determine which DNS requests to block. Installation of Pi-Hole in Docker is easy. Once set up, you can configure your router to forward DNS requests to your pi-hole server and you’ll immediately notice a difference in the websites that you visit.
This tutorial assumes you have Docker already installed on your system. If you need to install Docker, you can view the quick and easy steps to install docker post.
In order to maintain data persistence across container updates, Pi-Hole recommends that you create two volumes. One volume to store your application configuration data ( /etc/pihole ) and one volume to store DNS configuration ( /etc/dnsmasq.d ). To create the volumes run the following commands:
These commands will create persistent volumes on the host system. If you would like to create volumes using a network file share (NFS), you can follow the directions outlined in this post ( Note that using a NFS volume will reduce the speed of your Pi-Hole ).
Now that we have our volumes created, it is time to run the Pi-Hole. To quickly get Pi-Hole up and running you can run the following command:
This command uses the official Pi-Hole container image from the Docker Hub . Make sure you edit the TZ , WEBPASSWORD , and SERVERIP environmental variables.
Make sure to edit the variables in the command to match your setup. Below is a table of information about the variables used in the above command.
Once you have the Pi-Hole container up and running, you can access the web interface by opening your browser and pointing it to http://YOURSERVERIP/admin . You’ll be presented with the following screen:
On the left, you will see the login button. Press it and you will be presented with the admin login screen. Use the password that you defined in the WEBPASSWORD variable in the docker run command.
Once you login, you can click settings on the left sidebar. Then at the top, you can click DNS to adjust the DNS servers that you want to forward requests to. The default is set to Google’s DNS servers, but I prefer to use Cloudflare. You can select as many or as few DNS servers that you would like to use. If you are running unbound in docker , you can point the DNS servers to your unbound docker instance as well.
After you select your upstream DNS servers, select save at the bottom right hand corner of the screen.
Blocklists are the lists that Pi-Hole uses to determine which requests on the network get blocked. They are sourced from the community and are updated often. Pi-Hole currently has 6 installed by default.
To add an additional blocklist to Pi-Hole all you have to do is paste the URL of the blocklist into the field below the blocklist screen then click the Save and Update button.
One custom blocklist that I recommend to add to your installation is “ The Internet’s #1 Domain Blocklist “. The URL to paste into the Pi-Hole Blocklists screen is: https://dbl.oisd.nl . You can find other types of lists to use with your installation here .
Now that Pi-Hole in Docker is up and running it is time to point all of your network devices to the Pi-Hole container. The easiest way to do that is through your home router. You must configure your home router to have DHCP clients use Pi-Hole as their DNS server.
When you log in to your routers configuration page find the LAN (not WAN) DHCP/DNS settings section. Once you find it, you are going to want to set the DNS server to the IP address of your Pi-Hole. This is also the same address you set in the SERVERIP variable in the docker run command. Your Pi-Hole IP address should be the only DNS server in your router DHCP settings.
Once you save these settings, restart your devices and once they come back online, they should be using Pi-Hole as their DNS server.
Now that you have Pi-Hole up and running, you can log back into the admin screen and you will start to see the requests that are being sent to Pi-Hole from your network.
It should be noted that Pi-Hole will not block 100% of the ads and cannot block ads from YouTube. But, if you browse the internet a lot or have a lot of smart home devices, it won’t take long for you see the benefit of having a Pi-Hole running on your network.
5 Simple Commands to Clean up Docker
Use Watchtower to automate Docker Container Updates
I’m using linux mint 19.3.
Your recipe fails because port 53 is held by ‘stubby,’ a dohicky
that encrypts outgoing requests, they say.
I’m new to docker and your instructions have been very helpful.
hi can you resolve this problem on linux mint 19.3 ?
I ran across another problem with the pihole docker image. The TLS certificate is expired and I get this error:
“Error: error while loading TLS certificate in /var/lib/docker/swarm/certificates/swarm-node.crt: certificate (1 – mk63gjvvmyzhv13gafhu71h77) not valid after Fri, 06 Mar 2020 04:18:00 UTC, and it is currently Sun, 19 Jul 2020 07:38:44 PDT: x509: certificate has expired or is not yet valid”
It sounds like the image needs a newer cert.
Great post, thanks for the tutorial!
However, I got this error when using the docker run command you provided:
“DNS resolution is currently unavailable”
The solution is to add the following parameter in the docker run command:
–dns 127.0.0.1 –dns 1.1.1.1
Copyright © 2022 | WordPress Theme by MH Themes
Change your time zone with the correct time zone from the TZ Database .
Change YOURPASS with a password that you will use to access the application.
Change YOURSERVERIP to the IP address of your docker host machine.
Volume mapping the pihole volume that you created to the /etc/pihole folder within the container.
Volume mapping the dnsmasq volume that you created to the /etc/dnsmasq.d folder within the container.
Mapping port 80 on the host machine to port 80 on the application container. This is for the admin container and to ensure that ads that are blocked on your network show up blank.
Mappin
French Kiss Porno
Holed Net
Big Grandma Xxx

Report Page