Adguard
Here I use a MACVLAN in order to give the DNS server a different address from the server it is being hosted on. You need to make sure that this address is not being used by anything else in your network.
services:
adguard:
container_name: adguard
image: adguard/adguardhome
restart: always
ports:
- 53:53 # plain DNS
- 80:80/tcp # http web server
- 443:443 # htps web server
- 3000:3000/tcp # web management
volumes:
- /var/lib/adguardhome/conf:/opt/adguardhome/conf
- /var/lib/adguardhome/work:/opt/adguardhome/work
networks:
adguard:
ipv4_address: 192.168.0.32
networks:
adguard:
name: adguard
driver: macvlan
driver_opts:
parent: ens18
ipam:
config:
- subnet: 192.168.0.0/24
gateway: 192.168.0.1
If you want to use Adguard Home as a DNS server for the machine hosting it as well, you will need to create a network bridge to allow it to talk to the MACVLAN address. You can also use another DNS server instead.
To create the bridge in Debian, first create a new service:
In that file, enter the following (making sure to use the appropriate IP addrsses and adapter name):
[Unit]
Description=Macvlan interface for AdGuard Home
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/sbin/ip link add macvlan0 link ens18 type macvlan mode bridge
ExecStart=/sbin/ip addr add 192.168.0.33/32 dev macvlan0
ExecStart=/sbin/ip link set macvlan0 up
ExecStart=/sbin/ip route add 192.168.0.32/32 dev macvlan0
ExecStop=/sbin/ip route del 192.168.0.32/32 dev macvlan0
ExecStop=/sbin/ip link del macvlan0
[Install]
WantedBy=multi-user.target
If you need to locate the adapter name, you can use ip a to view the network adapters and ip addresses on interfaces.
Then, refresh the daemons and enaable and start the service:
You can check the status of the service:
You should now also be able to ping the IP address as well from the docker host.