AdGuard Home on Docker with IPv6

This blog will explain how to install AdGuard Home in a Docker container and enable IPv6 networking in order to enable IPv6 DNS resolution.

Docker install

For the purpose of this blog I am not going into details of installing Docker itself and assume a system with docker installed exists. Details about installing Docker can be found here: https://docs.docker.com/engine/install/

If you want to use IPv6 networking make sure you do this after the installation: https://docs.docker.com/config/daemon/ipv6/

Also I am using docker compose to make it easier to manage the containers. On a Debian based system docker compose can be installed with:

sudo apt install docker-compose

Networking

The simplest way to run a docker container is to use the host network. For AdGuardHome this is sometimes not desired as it uses default ports, like port 53, that might already be used by the host system. Especially on Ubuntu port 53 is per default used by the DNS Stubresolver and in order to get AdGuard Home working this needs to be disabled.

To avoid all this problem I am creating a own docker network using the macvlan driver so the host is visible as a host on the local network.

Setting up a virtual LAN interface:

docker network create -d macvlan --subnet=192.168.1.0/24 --gateway=192.168.1.1 --ipv6 --subnet=fd59:c039:d3b8::/64 --gateway=fd59:c039:d3b8::1 -o parent=eth0 local_lan

This will create a virtual LAN called “local_lan”. The parent is “eth0” which is the physical interface and you might to change this to whatever your physical interface is.

The “fd59:c039:d3b8:d3b8” is a random prefix that is used for the IPv6 subnet. You can use anything here or even just call it “fd00::” which is the default but not recommended as it might interfere with other networks.

Adguard Home Installation

Get the AdGuard Docker image:

docker image pull adguard/adguardhome 

Create two config directories:

<DOCKER_DIR>/adguard/conf
<DOCKER_DIR>/adguard/work

Create a docker-compose.yaml file with the following content:

version: "3"
services:
  adguardhome:
    image: adguard/adguardhome
    container_name: adguardhome
    volumes:
      - <DOCKER_DIR>/adguard/work:/opt/adguardhome/work
      - <DOCKER_DIR>/adguard/conf:/opt/adguardhome/conf
    restart: unless-stopped
    networks:
      local_lan:
        ipv4_address: 192.168.1.30
        ipv6_address: fd59:c039:d3b8::30

networks:
  local_lan:
    external:
      name: local_lan

Now you can start you AdGuard Home docker with:

docker-compose -f docker-compose.yaml up -d

Note: The -d option makes it run as a daemon. If anything doesn’t work run the docker-compose without the -d option to the the console log.

AdGuard Home Setup

After the docker container is start up you can connect to AdGuard via the IP you define in the docker compose file and port 3000:

http://192.168.1.30:3000

That’s it. AdGuardHome running in it’s own docker container with full network access.