Build kit · WireGuard docker compose · 833 B

wg-easy home VPN — build kit

The compose file I actually ran, with the three fixes the circulating instructions leave out: a bcrypt PASSWORD_HASH, $$-escaped $ in .env, and the admin panel bound to loopback. No keys, no password, no client configs in here — generate your own.

Download docker-compose.yml Download README.md Read the analysis

Before you run this: it only works if the machine stays at home, awake, and the router has a public IPv4 to forward UDP 51820 to. A WAN address starting 100.64, 10. or 172.16–31 is carrier-grade NAT and there is no port to forward.

docker-compose.yml

services:
  wg-easy:
    image: ghcr.io/wg-easy/wg-easy:latest
    container_name: wg-easy
    restart: unless-stopped
    env_file:
      - .env
    environment:
      - WG_PORT=51820
      - INSECURE=true          # plain HTTP admin UI; loopback-bound below
    volumes:
      - etc_wireguard:/etc/wireguard
    ports:
      - "51820:51820/udp"                  # the tunnel
      - "127.0.0.1:51821:51821/tcp"        # admin UI, this machine only
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    sysctls:
      - net.ipv4.ip_forward=1
      - net.ipv4.conf.all.src_valid_mark=1

volumes:
  etc_wireguard:

.env — write it yourself

WG_HOST=<home public IP or DNS name>
PASSWORD_HASH=$$2a$$12$$<bcrypt hash>

hash = docker run --rm --entrypoint node ghcr.io/wg-easy/wg-easy:latest -e "console.log(require('bcryptjs').hashSync('YOURPASSWORD',12))"

What changed from the popular instructions

Password → hash

PASSWORD= aborts the container with an explicit error. v14 wants a bcrypt PASSWORD_HASH, generated inside the image.

Hash → dollar signs

compose interpolates .env values, so an unescaped hash becomes $2a$12$ and blanks. The app then reports no password required and the panel is open.

51821 stays local

The admin panel is not part of the VPN. Forward only 51820/udp; reach the UI over SSH or sit at the box.

1420 MTU

WireGuard adds ~60 bytes per packet, so wg-quick drops the interface MTU to 1500 − 80 to avoid fragmentation.