Wireguard docker setup

About the Wireguard

The initial requirements for running wireguard

  • external UDP port listen, ie 51820
  • qrencode tool to generate qrcode for wireguard client config

Enable external listen to 51820/udp

sudo ufw allow 51820/udp

Install qrencode

sudo apt install qrencode

docker config

docker run -d \
  --name=wireguard \
  -P --net docker-net \
  --ip=172.100.156.253 \
  --cap-add=NET_ADMIN \
  --cap-add=SYS_MODULE \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Asia/Hong_Kong \
  -e SERVERURL=107.175.91.49 \
  -e SERVERPORT=51820  \
  -e PEERS=1  \
  -e PEERS=2  \
  -e PEERS=3  \
  -e PEERS=4  \
  -e PEERS=5  \
  -e PEERDNS=1.1.1.1 \
  -e INTERNAL_SUBNET=10.13.156.0  \
  -e ALLOWEDIPS=0.0.0.0/0  \
  -e LOG_CONFS=true `#optional` \
  -p 51820:51820/udp \
  -v /home/clam/docker/wireguard/config:config \
  -v /lib/modules:/lib/modules \
  --sysctl="net.ipv4.conf.all.src_valid_mark=1" \
  --restart no \
  linuxserver/wireguard:1.0.20210914

Generate qrcode for wireguard client

cat peer5.conf | qrencode -t ansiutf8

OR

docker exec -it wireguard /app/show-peer 5

Check Wireguard status

docker exec -it wireguard wg show

This page was last edited on 2024-08-21 17:33

Powered by Wiki|Docs

This page was last edited on 2024-08-21 17:33

Mac
To whom it may concern

Powered by Wiki|Docs