New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Need document on how to access pihole from a different container #438
Comments
I think you can solve this using Stepsdocker network create pihole # create a new network for your containers to talk over
# when starting your pihole add this option: --network
docker run \ # your options go here...
--network pihole \ # this tells your pihole to be on the "pihole" docker network
pihole/pihole:latest
# determine your pihole's IP address on the "pihole" docker network
docker network inspect pihole # find the Containers field with the name "pihole"
PIHOLE_IP=0.0.0.0 # replace 0.0.0.0 with the value from the "IPv4Address" field
# start your other container
docker run \ # other container options
--network pihole \ # tell it to use the same "pihole" network
--link pihole \ # tell it to link to the pihole container on the "pihole" docker network
--dns ${PIHOLE_IP} \
alpine:latest \ # or your container name
/bin/sh # your container command Then 🤞 it should work for you.... Tests I Used
Give it a try and let me know how it goes! |
Yes at the end I figured out how to do this. Your solution is actually not complete, as there's no guarantee the In order to guarantee you get a static IP address, you have to specify the You can create a network in the In the end I figure this is the simplest you can do:
Unfortunately you still need to specify |
Any more efficient way to do this? I'm having the same problem. |
Cheers 🍻 @yegle I had been banging my head about this one for a while. Still feels like a bit of a work-around but as this issue states, would be helpful to include in documentation if it is in fact the correct method. |
In case it might help someone else, here's the docker-compose.yaml file I'm using: |
@yegle 2 years later it seems it still is the right method. Thanks. One thing I don't know about is what happens to name resolution of the docker network itself (you can reach another container by using its name). I don't know if the use of PiHole inhibits that. |
This issue is stale because it has been open 30 days with no activity. Please comment or update this issue or it will be closed in 5 days. |
This still needs documentation and should not be closed. |
Seems like there are some solutions in this issue thread. PRs are welcome - we don't bite too hard |
When running container on same network, you can just refer to it as its domain name.
It will just work, even if you are using docker swarm and deploying containers in different machines using docker stack for example |
This is a...
Description
I'm puzzled by how to provide the PiHole DNS service to a different docker container on the same server. Apparently using HOST_IP:53 doesn't work for some reason.
Expected Behavior
HOST_IP:53 should work
Actual Behavior
Timeout
Possible Fix
Steps to Reproduce and debugging done
e.g. your docker run command, pages to visit, CLI commands you ran
1.
2.
3.
4.
Debug steps I have tried
docker run
example in the readme (removing any customizations I added)Context and extra information
Your Environment
The text was updated successfully, but these errors were encountered: