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
  wireguard:
    container_name: wireguard
    image: linuxserver/wireguard
    depends_on:
      - adguard
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Asia/Hong_Kong
      - SERVERURL=zion.thematrix.dev
      - SERVERPORT=51820
      - PEERS=user1,user2,user3
      - PEERDNS=auto
      - INTERNAL_SUBNET=10.0.0.0
    ports:
      - 51820:51820/udp
    volumes:
      - type: bind
        source: ./config/wireguard/
        target: /config/
      - type: bind
        source: /lib/modules
        target: /lib/modules
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
volumes:
  adguard-work:
networks:
  default:
    driver: bridge
    ipam:
      driver: default
      config:
        - subnet: 172.172.0.0/24
          gateway: 172.172.0.1
docker-compose up -d