---
version: '3.7'
services:
adguard:
container_name: adguard
image: adguard/adguardhome
restart: unless-stopped
ports:
- "53:53/tcp"
- "53:53/udp"
- "853:853/tcp"
- "9001:80/tcp"
- "9002:443/tcp"
- "9003:3000/tcp"
# Therese 3 are required if you want to use AdGuard as a DHCP server
# - "67:67/udp"
# - "68:68/tcp"
# - "68:68/udp"
volumes:
- ./conf:/opt/adguardhome/conf
- ./data:/opt/adguardhome/work
- ./certs:/opt/adguardhome/certs # remember to put this path in the UI too
Admin panel should be available at https://localhost:9002
- Generate hash
It will print
htpasswd -B -n -b <USERNAME> <PASSWORD>
<USERNAME>:<HASH>
to the terminal. - Open AdGuardHome.yaml
nano adguard/conf/AdGuardHome.yaml
- In the
users:
section update:users: - name: username password: <HASH>
- Save & restart AdguardHome
Add extra_hosts
node to the docker-compose.yml
with the mapping, like so:
extra_hosts:
- "HomeServer:192.168.1.20"
This will inject the map to the /etc/hosts
file of the container,
which AdGuard will use to show the nice names.
Alternatively this can be done through the Admin UI.
- First, disable and stop Ubuntu's DNS resolver using the following two commands:
sudo systemctl disable systemd-resolved.service sudo systemctl stop systemd-resolved.service
- Next, open network manager configuration using the following command for editing:
sudo nano /etc/NetworkManager/NetworkManager.conf
- Add
dns=default
under[main]
so that the file contents look like this:[main] plugins=ifupdown,keyfile dns=default
- Then either remove or rename
/etc/resolv.conf
(it's a symbolic link) using the the following command:sudo mv /etc/resolv.conf /etc/resolv.conf.bak
- In case there is a problem, you can rename the file back to
/etc/resolv.conf
. - Finally, restart your network manager using the following command:
sudo service network-manager restart
- If that doesn't work, use this:
ps aux | grep dns # get the PID of the dns process sudo kill -9 <PID> # kill it