___ # Tags #adguard #dns #docker #portainer #homelab # Helpful Docs - Link to [Adguard Github page](https://github.com/AdguardTeam/AdGuardHome/wiki/Docker) - Link to [Adguard Dockhub page](https://hub.docker.com/r/adguard/adguardhome) # Notes - Pull the image you want using Portainer, I prefer to pick a fixed version opposed to using `Latest` because when I upgrade I want it to be an intentional process ![[Pasted image 20230203092653.png]] - Here is the default command to run the docker container recommended by the DockerHub page - You need to open ports 53, 80, and 3000, if you are only running this as a DNS server, you'll need to open more if you are trying to use this for DHCP or other services ```shell docker run --name adguardhome\ --restart unless-stopped\ -v /my/own/workdir:/opt/adguardhome/work\ -v /my/own/confdir:/opt/adguardhome/conf\ -p 53:53/tcp -p 53:53/udp\ -p 67:67/udp -p 68:68/udp\ -p 80:80/tcp -p 443:443/tcp -p 443:443/udp -p 3000:3000/tcp\ -p 853:853/tcp\ -p 784:784/udp -p 853:853/udp -p 8853:8853/udp\ -p 5443:5443/tcp -p 5443:5443/udp\ -d adguard/adguardhome ``` - You'll also need to create 2 volumes in Portainer, one for **conf** and one for **work** ![[Pasted image 20230203093026.png]] - When you provision the ports, volumes, network, and you click **Deploy the container** you might run into an error where it won't work - This is because port port 53/tcp/udp can be taken by something called `DNSStubListener` which is used by the `resolved` daemon - You will have to login to the server running the docker containers and do the following steps - Deactivate DNSStub by editing `/etc/systemd/resolved.conf` ![[Pasted image 20230203100703.png]] - Now go create a directory `/etc/systemd/resolved.conf.d` and create a file there called `adguardhome.conf` and add the following config ``` [Resolve] DNS=127.0.0.1 DNSStubListener=no ``` - Now activate the new `resolve.conf` by running these commands ```shell mv /etc/resolv.conf /etc/resolv.conf.backup ``` ```shell ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf ``` - Now reload `systemd-resolved` with this command ```shell systemctl reload-or-restart systemd-resolved ``` - Re-deploy the Adguard Home container and see if it works - I had no issues - Point your DHCP servers at your new DNS server and adjust any firewall rules at the network level accordingly and you should start receiving DNS queries ![[Pasted image 20230203101223.png]]