Install AdGuard with Docker on Ubuntu

Install Docker and Docker-Compose

Install Docker and Docker-Compose on Ubuntu 20.04
DockerInstall necessary tools: sudo apt install apt-transport-https ca-certificates curl software-properties-common -y Add Docker key: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - Add Docker repo (choose the correct repository): 32bit / 64bit OS sudo add-apt-re…

Change DNS setting on the host

sudo mkdir -p /etc/systemd/resolved.conf.d/
sudo nano /etc/systemd/resolved.conf.d/adguardhome.conf
[Resolve]
DNS=127.0.0.1
DNSStubListener=no
sudo mv /etc/resolv.conf /etc/resolv.conf.backup
sudo ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
sudo systemctl reload-or-restart systemd-resolved

Create Docker-Compose file

mkdir -p config/adguard/
nano docker-compose.yml
version: '3.8'
services:
  adguard:
    container_name: adguard
    image: adguard/adguardhome
    volumes:
      - type: volume
        source: adguard-work
        target: /opt/adguardhome/work
      - type: bind
        source: ./config/adguard/
        target: /opt/adguardhome/conf
    ports:
      - "53:53/tcp"
      - "53:53/udp"
#      - "67:67/udp"
#      - "68:68/tcp"
#      - "68:68/udp"
#      - "80:80/tcp"
#      - "443:443/tcp"
#      - "853:853/tcp"
      - "3000:3000/tcp"
    cap_add:
      - NET_ADMIN
    restart: unless-stopped
volumes:
  adguard-work:
docker-compose up -d