BLOCK EVERYTHING w/ PiHole on Docker, OpenDNS and IFTTT
Based on NetworkChuck's video on YouTube. If you like this content, support the original creators by watching, liking and subscribing to their content.
Run Pi-hole in Docker, but disable Ubuntu’s systemd-resolved DNS service first to prevent DNS conflicts.
Briefing
A self-hosted Pi-hole DNS server running inside Docker can block streaming and other unwanted domains across a home network—and the setup can be automated so a voice command triggers new block/unblock rules on demand. The practical payoff is immediate: once devices point their DNS to Pi-hole, requests for sites like Netflix, Hulu, and Disney Plus get intercepted and denied before they consume bandwidth or reach the wider internet.
The build starts with a Linux machine (Ubuntu in the example) running a Docker container that bundles Pi-hole plus a Flask-based control layer. Because newer Ubuntu installs its own local DNS resolver, the process first stops and disables that service (systemd-resolved) and then updates /etc/resolv.conf so the host can still resolve names while Pi-hole takes over DNS duties. After Docker is installed, a prepared bash script creates the Pi-hole container from a Docker image pulled from Docker Hub, then exposes the container’s web admin interface and DNS ports.
Once the container is up and healthy, Pi-hole’s web UI is reachable at the machine’s IP address, with the admin panel at /admin. The default password is changed, and the upstream DNS settings are configured to use OpenDNS—leveraging OpenDNS for additional filtering while Pi-hole handles local domain blocking. To confirm everything works, the network’s DNS is pointed to the Pi-hole IP and DNS lookups (e.g., nslookup for Google and Facebook) are verified; the Pi-hole query log then shows that client traffic is flowing through the server.
The “automation” portion adds a Python script (network.py) and two bash scripts that manage regex-based blocklists. Instead of manually editing Pi-hole’s blacklist for every site, the scripts accept commands that apply or remove regex rules targeting domains such as Hulu, Netflix, and Disney Plus. A test run shows that calling the Flask endpoint on port 8080 with a “block” or “unblock” action updates Pi-hole’s blocking behavior in real time.
To connect this to voice control, the workflow uses IFTTT. An Alexa trigger (“break everything”) calls a Webhook request to the Pi-hole control URL, swapping the action parameter between block and unblock. A key networking requirement is that IFTTT must reach the control endpoint via a public IP address, which typically means port-forwarding router traffic for port 8080 to the internal server. After wiring the Alexa-to-Webhook recipe, the system can be tested by attempting to access blocked services and then checking Pi-hole’s query log to confirm the regex matches.
The result is a layered filtering setup: Pi-hole blocks at the DNS level, OpenDNS adds content filtering, and IFTTT provides a simple remote control mechanism. The transcript also notes a measurable benefit from running it for about a week—roughly a quarter of requests were blocked—reducing unnecessary traffic before it ever leaves the network.
Cornell Notes
Pi-hole in a Docker container can act as a home network DNS gatekeeper, blocking unwanted domains like Netflix and Hulu as soon as devices point their DNS to it. The setup on Ubuntu requires disabling the built-in DNS resolver (systemd-resolved) to avoid conflicts, then installing Docker and launching a Pi-hole container from a Docker image via a script. After Pi-hole is running, its admin UI is used to change the password and configure upstream DNS to OpenDNS for additional filtering. Automation is added through a Python/Flask control endpoint (port 8080) plus scripts that apply or remove regex-based blacklist rules. IFTTT then connects Alexa voice commands to Webhook calls so “block” or “unblock” actions can be triggered remotely, provided the endpoint is reachable via a public IP and router port-forwarding.
Why disable Ubuntu’s built-in DNS resolver before installing Pi-hole?
How does the Docker-based Pi-hole setup get created and started?
What role does OpenDNS play once Pi-hole is running?
How are domain blocks automated without manually editing Pi-hole’s blacklist each time?
What networking changes are required for Alexa/IFTTT to trigger blocking remotely?
How can you verify that blocking is actually working?
Review Questions
- What conflict does systemd-resolved create with Pi-hole, and what exact steps are used to resolve it?
- How do the block/unblock scripts differ in their command structure, and how does the Flask endpoint on port 8080 control them?
- Why does the IFTTT Webhook URL need a public IP and router port-forwarding for port 8080?
Key Points
- 1
Run Pi-hole in Docker, but disable Ubuntu’s systemd-resolved DNS service first to prevent DNS conflicts.
- 2
Update /etc/resolv.conf after disabling systemd-resolved so the host can still resolve names while Pi-hole handles client DNS.
- 3
Launch the Pi-hole container via a bash script that pulls the Docker image from Docker Hub and exposes the admin UI and control ports.
- 4
Configure Pi-hole upstream DNS to OpenDNS to combine local domain blocking with OpenDNS filtering.
- 5
Use regex-based blacklist rules managed by scripts so “block” and “unblock” can be applied automatically rather than manually.
- 6
Expose a Flask control endpoint (port 8080) and trigger it via IFTTT Webhooks tied to Alexa phrases.
- 7
For remote automation, ensure the control endpoint is reachable from the internet using a public IP and router port-forwarding for port 8080.