Skip to content

Pi-hole in Container Manager on a Synology NAS

Last updated on 5 April 2025

Important or Recent Updates
Historic UpdatesDate
Updated guide for Container Manager and using Macvlan14/05/2023
Added a new section to ensure DSM continues having network access.02/06/2023
Guide updated so you can choose between Macvlan or Bridge mode12/08/2023
Added additional security option to the compose to restrict the container from gaining new privileges25/10/2023
Fixed issues I introduced with the recent changes in my mission to make things more secure. It was so secure I broke it!
Added the appropriate permissions/capabilities at start up for the container.
29/10/2023
Removed the requirement for the synobridge as this container can just use its own bridge, and added the Host network mode, so all three are a choice.28/01/2024
Removed the WEB_UID and WEB_GID from the config to avoid issues with ID’s conflicting inside the container. I will update again once I have some time to work around this.03/04/2024
Some minor amends to sync up the information across this guide and the AdGuard one01/08/2024
Removed two unneeded capabilities from the bridge version of the docker compose as they are not required.16/11/2024
Guide updated for the all new v6 of Pi-hole (Note if you upgrade from v5 you effectively have to change all the compose settings in line with the new guide so might be worth just scrapping and starting fresh unless you really need stats etc

Please note as recommended by the Pi-hole dev team I have added a Watchtower exclusion label to the compose so you can do manual updates. Automated ones could result in you losing internet access if a bad update takes place.

Edited again today as I left in a variable that is not required in Host and Macvlan mode “DNSMASQ_LISTENING” sorry.
20/02/2025
Had a rethink of the Guide, and it has been rewritten to include an overdue request of including Unbound!24/02/2025
Fixed my idiocracy adjusted the MACVLAN section to actually put Unbound on the same network.. Facepalm!16/03/2025
I need to do some more testing of Unbound as part of the guide and I don’t currently have a lot of time so to avoid issues I have removed it from the guide for now.18/03/2025
Historic Updates

What is Pi-hole?

If you are looking to get advertising and tracking blocked across all the devices on your network a Pi-hole will have you covered. It’s a locally hosted Domain Name Server and uses block lists to stop adverts.

This guide will get you set up with Pi-hole and cover some basic initial settings, I recommend checking out the documentation for all the various features available.

Pi-hole GitHub

Host vs Bridge vs Macvlan Network Modes

You need to decide which mode of Networking you want to use, I have outlined the key points below in general order of preference.

Host:

Host mode uses your NAS underlying network to run the containers network services, so it will be reliant on the NAS not using any of the required ports for the container. However, this makes it easy to set up, but you need to make sure no other service is using the required ports. All your clients will appear correctly as independent devices and stats.

Bridge Mode:

The main benefit of Bridge Mode will be the ease of setup however you will find that all clients on your network will appear under the same IP as the Bridge 172.20.0.1. This won’t impact ad blocking, but it will mean you can’t apply device specific rules etc.

Macvlan:

This gives you the benefit of Pi-hole having its own IP address on your network, all clients appear with their real IP addresses allowing you to assign specific rules and give you some nicer stats. However, one downside is that your NAS will not be able to use Pi-hole for DNS, due to the additional security features of Macvlan and its communication with its host. This is generally not an issue unless you wanted to use your Ad blocking with Tailscale.

Please note if you have a bonded network connection (two LAN ports bonded into one) then try using ‘bond0’ in the network set up element of this guide.

Let’s Begin

In order for you to successfully use this guide you will need to check that your Router allows you to change your network DNS servers, this is usually found in the DHCP settings.

Please follow the initial guide below to get a restricted Docker user set up, then come back here.

Folder Setup

Let’s start by getting some folders set up for the container to use. Open up File Station create the following.

Folders
/docker/projects/pihole-compose
/docker/pihole

Container Manager

Next we are going to set up a ‘Project’ in Container Manager. Open up Container Manager and click on Project then on the right-hand side click ‘Create’.

In the next screen we will set up our General Settings, enter the following:

SectionSetting
Project Name:pihole
Path:/docker/projects/pihole-compose
Source:Create docker-compose.yml

The code section of the below will be blank until we move to the next step.

Next we are going to drop in our docker compose configuration. You now need to decide if you are going to go with Host, Bridge Mode or Macvlan. Jump to the appropriate page to follow the setup.

Host – Page 2
Bridge – Page 3
Macvlan – Page 4

Pages: 1 2 3 4 5

Published inAd-Blocking / DNS 7.2DockerSynology

208 Comments

  1. Nick Nick

    Wouldn’t it be good to store the dnsmasq.d folder outside if the Docker image? That would make updating Pihole easier, wouldn’t it?

    • Dr_Frankenstein Dr_Frankenstein

      From what I understand It’s now not required and is an optional mount point for custom dnsmasq amendments. If you want to add it back in that’s fine

      • Nick Nick

        You’re right, it’s in the documentation, I had found it later yesterday. Perfect, thank you!

  2. Bellsivo Bellsivo

    I followed the guide (using macvlan mode) and it builds and starts fine. However, when I try to access the dashboard using (http or https)://macvlanIP/admin it gives me an ERR_EMPTY_RESPONSE. If I access the same IP without /admin then it gives me an Oops 403 page…no permission…”did you mean to go to your Pi-Hole’s dashboard instead?” with part of that hyperlinked to the same macvlanIP/admin I can’t access. So Pi-hole is there and able to serve up a webpage but is denying me any access to the admin dashboard. Any ideas?

  3. David David

    Hi ! just FYI

    After a LOT of struggle with trying to use macvlan and always coming to the same error at the end: “Cannot create macvlan: device or resource busy”. The magic was in the network interface used. When i used parent: ovs_eth0 everything works as a charm. Pihole V6 running in docker on his own ip address.

    David.

  4. czee czee

    For some reasons my pi-hole is not stopping adverts on mobile apps, note I have andriod with private DNS already disabled in phone and current pihole setup running via a bridge

    • Dr_Frankenstein Dr_Frankenstein

      Hi check in your WiFi details that it’s using your nas IP for the DNS settings. If you have only just set this up you can force a dhcp update by disconnecting and reconnecting to WiFi

  5. João João

    Hi there,

    Pi-hole V6 has been launched, will this guide still work? I have installed it again, i got pi-hole v5 still, how can i upgrade?

    Thanks

    • Dr_Frankenstein Dr_Frankenstein

      Hey see my note at the top of the guide I am on holiday so will make the changes when back.

Leave a Reply to João Cancel reply

Your email address will not be published. Required fields are marked *

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

drfrankenstein.co.uk – writing Synology Docker Guides since 2016 – Join My Discord!