If you read our post about compiling your own binaries for WD MyCloud OS5 where we explained how to install and use packages like Docker, you may want to deploy your first container.
Say you have installed any extension like uBlock in your browser that blocks all the ad crap from the websites you visit. Sometimes it is just not enough: you may not be able nor want to install browser extensions on mobile devices, or simply sometimes you don’t even have the chance to do so.
Friendly reminder: we maintain this site thanks to ads after all, maybe we’re shooting ourselves in our foot with this post though! It’s okay, we understand it, even support it.
Given that, you’ll need to change the scope of the solution. In this case, we propose stepping up from the browser level to the network, DNS level. That’s where we are focusing today, and yeah, we will make our NAS provide that feature!
Pre-checks
Before starting, have you tried to run the basic Docker command in your NAS? Remember you can do this by just connecting via SSH and typing:
$ docker -v
Docker version 20.10.12, build e91ed57
There we go, we have Docker available, ready to deploy a PiHole container to block almost every ad around the Internet.
Installing PiHole on Docker
At this point you can just visit our profile on GitLab and clone the wdmycloud-dockerfiles repository, where you can find a variety of software pieces ready to run on your MyCloud OS5 NAS.
$ git clone https://gitlab.vectops.com/aletz/wdmycloud-dockerfiles.git
$ cd wdmycloud-dockerfiles/pihole
Now, run this command and let the magic happen:
$ docker-compose up -d
It will:
- Pull the PiHole Docker image in your NAS
- Apply a basic configuration to fire up the container
After it finishes, you will be able to manage your Pihole through its web UI in the following URL: http://you_nas_ip:8080/admin.
Configuring your environment
From this panel you can configure lots of things to get PiHole working in your local network as you’d like to. Now it’s time to configure your network to start using your PiHole instance at a DNS configuration level. You have multiple ways to do:
- Configure your DNS in DHCP Server on your main router
- Configure each device with this custom DNS
I prefer configuring the DNS in the dhcp-server, so every device on my network uses DHCP protocol to get access to the Internet (and yes, it is possible to use "static IP addresses" with the dhcp-server lease option) and gets all the ads blocked by default with no extra effort.
After this step, you are done setting everything up and will start browsing ad-free from every device on your network!
Thank you for reading, I would be very pleased to know if this article helped you get a PiHole working on your local NAS!
See you next time. Don’t forget to share & leave a comment!
The repository doesn’t seem to be available using the git clone command listed above, even though I’m using my personal access token. When I view the profile, it doesn’t list any public repositories… Granted I’m not proficient using GitHub…
Hello Ben!
Sorry for the delay. Recently we move some repositories from GitHub to GitLab, and we need to reconfigure the public access on some repos.
We create this repository in my personal account, so you can clone the repo from here: https://github.com/awuth/wdmycloud-dockerfiles
Thanks!
See you.
Thats the output when i try to start the docker-compose. Please help.
standard_init_linux.go:211: exec user process caused “exec format error”
failed to resize tty, using default size
Hello
What OS version you have? and what is the WD My Cloud model have? Which version of docker?
Regards.
Sorry if I missed it but what is the default pi-hole password?
By default, the pihole set a random password, you can check in the logs maybe.
If you want to change the pihole password, enter in the container and execute “pihole -a -p” to change it.
If you have a Dockerfile, you can set a empty password, check this line: https://github.com/awuth/wdmycloud-dockerfiles/blob/master/pihole/docker-compose.yaml#L17 Set it with WEBPASSWORD: ‘ ‘ and redeploy the container.
Regards.
It does not work on EX2Ultra under OS5. First couldn’t install GIT, but was able to get the directory there. But then I got this error:
[email protected] pihole # docker-compose up -d
standard_init_linux.go:211: exec user process caused “exec format error”
failed to resize tty, using default size
Thanks
Hello
What OS version you have? and what is the WD My Cloud model have? Which version of docker?
Regards.