Post

Install & configure Wireguard in Docker

Install & configure Wireguard in Docker

Your very own VPN-service and it’s also linked to AdGuard Home. ;o)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
services:
  wireguard:
    image: lscr.io/linuxserver/wireguard:latest
    container_name: wireguard
    cap_add:
      - NET_ADMIN
      - SYS_MODULE #optional
    environment:
      - PUID=${PUID}
      - PGID=${PGID}
      - TZ=${TZ}
      - SERVERURL=${SERVERURL}
      - SERVERPORT=${SERVERPORT}
      - PEERS=${PEERS}
      - PEERDNS=192.168.1.253 #optional
      - INTERNAL_SUBNET=10.13.13.0 #optional
      - ALLOWEDIPS=0.0.0.0/0 #optional
      - LOG_CONFS=true #optional
    volumes:
      - ./config:/config
      - /lib/modules:/lib/modules #optional
    ports:
      - 51822:51820/udp
    networks:
      adguard_default:
        ipv4_address: 172.30.0.3 # fixed IP address
    sysctls:
      - net.ipv4.conf.all.src_valid_mark=1
    restart: unless-stopped
networks:
  adguard_default:
    external: true

Usage

If you want to show a QR-Code for specific peer in CLI then:

1
docker exec -it wireguard /app/show-peer <PEER>
This post is licensed under CC BY 4.0 by the author.