anudeepND / whitelist

A simple tool to add commonly white listed domains to your Pi-Hole setup.
MIT License
4.21k stars 281 forks source link

How to run python3 from within a docker container running on a Synology NAS? #235

Open ghost opened 2 years ago

ghost commented 2 years ago

I have used Docker to install PiHole with its own IP-address on a Synology NAS. I have tried to install your whitelist through SSH but are facing problems. I have python3 but not inside the docker container. I have tried to find a solution on how to call it from within the container but with no success.

SSH into docker

Svettballe@Moln:~$ sudo docker ps -q Password: 71772e7cb0d9 Svettballe@Moln:~$ sudo docker exec -it 71772e7cb0d9 bash root@Pihole-MacvlanNetwork:/# git clone https://github.com/anudeepND/whitelist.git Cloning into 'whitelist'... remote: Enumerating objects: 1058, done. remote: Counting objects: 100% (17/17), done. remote: Compressing objects: 100% (17/17), done. remote: Total 1058 (delta 7), reused 1 (delta 0), pack-reused 1041 Receiving objects: 100% (1058/1058), 661.32 KiB | 3.74 MiB/s, done. Resolving deltas: 100% (570/570), done. root@Pihole-MacvlanNetwork:/# cd whitelist/scripts root@Pihole-MacvlanNetwork:/whitelist/scripts# ls domains.sql referral.sh uninstall.py whitelist.py root@Pihole-MacvlanNetwork:/whitelist/scripts# sudo python3 whitelist/scripts/whitelist.py sudo: python3: command not found

Python exists outside container

Svettballe@Moln:/$ python3 Python 3.8.8 (default, Jun 2 2021, 08:52:25) [GCC 7.5.0] on linux Type "help", "copyright", "credits" or "license" for more information.

How did you manage to run “sudo python3 whitelist/scripts/whitelist.py “ when inside PiHole container in docker?

Some step that is too obvious to mention for a programmer must be missing in the instructions, and I as a beginner cant figure it out.

redbeardj commented 2 years ago

Did you ever figure this out? I'm having the same issue.

qquppsala commented 2 years ago

I'm having the same issue.

redbeardj commented 2 years ago

Anyone figure out a solution? I've tried a couple discord servers and noone seems to have an answer. It's either something extremely simple or it just doesn't work on synology for some reason.

ghost commented 2 years ago

Did you ever figure this out? I'm having the same issue.

No I did not figure this out, running PiHole without Whitelist until someone tells me how to.

michealespinola commented 1 year ago

You don't do any of this from inside the docker container. Your pihole should have container paths that are mounted to the local volume. These paths contain the databases that the whitelist adds itself into. You run the python command natively from your Synology terminal.

Here's an example of how I run the script on my system:

python3 /volume1/<...>/whitelist.py --dir /volume1/docker/pihole/pihole --docker

Its as easy as that. This is possible because I created my pihole container with the following docker run options:

--volume /volume1/docker/pihole/pihole:/etc/pihole \
--volume /volume1/docker/pihole/dnsmasq.d:/etc/dnsmasq.d \