How to Set Up a Static IP for Pi-hole in Docker on Windows?

0
8
Asked By TechieTurtle93 On

I'm trying to set up Pi-hole with Unbound in a Docker container on my Windows PC using a Docker Compose file. I want to assign a static IP address to the Pi-hole that isn't the same as my host machine's IP. However, even though the container seems to run fine, I can only access it using the Windows host's static IP instead of the static IP I specified in my YAML file. What's wrong with my configuration? Also, I get an error about services unless I run the command with the -d switch. Here's a snippet of my Docker Compose setup: I'm defining the network and stating the static IP I want. Can someone help identify what I might be missing?

2 Answers

Answered By DockerNewbieX On

I'm just getting started with Docker too! I’ve mainly used UnRaid for my applications, but I decided to try it on Windows for a change. I’d love to learn more about macvlan, especially how to use it. It sounds like the way to go if I want Pi-hole to have its own IP on the network. Any pointers on where to start?

Answered By CuriousCoder81 On

It looks like you're trying to assign a static IP from a Docker bridge network. This setup means that the IP address you specified (192.168.50.195) is only accessible to other Docker containers on that network. To allow external devices on your network to reach your Pi-hole using that specific IP, you might have better luck with a macvlan or ipvlan network configuration instead. With macvlan, you can make the Pi-hole directly accessible on your local network. Right now, the way you're trying to access it through the host IP is standard for bridge networking, so you're not doing anything wrong there, just limited by the network configuration.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.