Setting up Pi-hole, Nextcloud, and Home Assistant on Raspberry Pi using Docker

Jerameel Delos Reyes
4 min readMay 29, 2021

This is not a tutorial in itself, instead it is more of a personal note I wish I have read before doing this on my Raspberry Pi.

Hardware Limitations

  • You’ ll need a huge amount of RAM and a fast CPU to make this work. CPU Architecture should be also taken into consideration, note that you can only run Docker containers that is similar to your current CPU Architecture.
  • Connection speed is also essential for a file server (Nextcloud), so make sure that you have 5Ghz WiFi if you ever wanted to go wireless. And if you are using external storage, check that your storage and your Raspberry Pi supports USB 3.0 ( Available only on Raspberry Pi 4 as of this writing).
  • If USB 3.0 is not available, avoid external storage and just get a higher micro SD card. Things are a lot easier to setup when using only a micro SD card instead of having an additional external storage.

Initial Setup

Raspberry Pi OS

  • Choose the lite version(CLI only) install because we only need to manage everything via ssh.
  • Enable ssh and add WiFi credentials on the SD Card before putting it in our Raspberry Pi. This is called a Headless Setup.
  • Enable IP Address Reservation or Static IP for Raspberry Pi on your router.



Pi-hole Landing Page

If you have a lot of devices that is connected to the internet, Pi-hole would help a lot to monitor and block queries even up to DNS level. You can setup Pi-hole in different ways, such as using it as a DHCP server or a DNS server. Personally I have it setup as a DNS server only.

Since Pi-hole does a lot of things on the network level, it requires quite a few ports to be exposed (making it accessible outside the container) as is. Logically, this means even it is running within a docker container, its ports would still be the same as if we installed it directly on our local system.

One important thing to note is that this would occupy port 80, making it the default landing page when we access our Raspberry Pi via browser.

Docker Hub Link:


Nextcloud Pi Photos

I have made a lot attempt on setting up a usable file storage, but i ended up on using Nextcloud since it has a big community, it satisfies my use case(more on this later), and it’s the only one I managed to get to work. Other popular choices are Seafile and Pydio, unfortunately I have no success setting it up in docker.

I’ve only exposed port 80 on a different port (any port would do as long as it would not be used on other containers) because I only plan to use it locally (Offline). You must also specify the IP of device/s that can access Nextcloud, it is a good idea to set it up as 192.168.0.*, so you can access it from any device on your local network.

After the docker instance is running, it would not run properly at first. Since port 443 and 4443 is not exposed, you need to disable NCP Admin and https redirect by entering the shell of the instance.

I’ve also tried to set it up using external storage and it works after a few tweaks. It was really slow on my setup using Raspberry Pi 3b+ with only USB 2.0 port so I’ve just used a larger SD card instead.

Docker Hub Link:

Home Assistant

Home Assistant Dashboard

Having a lot of smart devices at home is great, not until you need to open different Applications for each devices just to control them. With Home Assistant, you can easily control all your devices at the same time and more other features that you didn’t know exists!

Setting this up is pretty straightforward, By default it only uses port 8123 so there’s no conflict on other setup. Something you might want to consider is making the Bluetooth interface accessible within the container, it would come in handy if you need Bluetooth Functions on Home Assistant later on.

Docker Hub Link:

Additional Notes

  • Docker has a feature called macvlan in which you can have separate ip address for each container, this is useful if you want to assign a custom domain name for each.
  • When using Pi-hole on router level, sometimes Raspberry Pi can’t connect to the internet because it uses Pi-hole as its DNS resolver, making it stuck in a loop. To solve this, you need to change /etc/resolv.conf to use other public name servers such as Google’s, you also need to run sudo chattr +i /etc/resolv.conf to make sure the file is not modifed when Raspberry Pi restarts.