wg-easy
Use these steps to run wg-easy for WireGuard VPN management with Docker Compose.
Create the Compose File
Create a docker-compose.yml file with the wg-easy service:
volumes:
etc_wireguard:
services:
wg-easy:
image: ghcr.io/wg-easy/wg-easy:15
container_name: wg-easy
networks:
wg:
ipv4_address: 10.42.42.42
ipv6_address: fdcc:ad94:bacf:61a3::2a
volumes:
- etc_wireguard:/etc/wireguard
- /lib/modules:/lib/modules:ro
ports:
- "51820:51820/udp"
- "51821:51821/tcp"
environment:
PORT: ${PORT}
HOST: ${HOST}
INSECURE: ${INSECURE}
restart: unless-stopped
cap_add:
- NET_ADMIN
- SYS_MODULE
sysctls:
- net.ipv4.ip_forward=1
- net.ipv4.conf.all.src_valid_mark=1
- net.ipv6.conf.all.disable_ipv6=0
- net.ipv6.conf.all.forwarding=1
- net.ipv6.conf.default.forwarding=1
networks:
wg:
driver: bridge
enable_ipv6: true
ipam:
driver: default
config:
- subnet: 10.42.42.0/24
- subnet: fdcc:ad94:bacf:61a3::/64
Create the Environment File
Create a .env file in the same directory as docker-compose.yml:
PORT=51821
HOST=0.0.0.0
INSECURE=false
Start wg-easy
Run Docker Compose from the directory containing both files:
docker compose up -d
The wg-easy web UI will be available at http://localhost:51821.
WireGuard VPN traffic uses UDP port 51820.
Reverse Proxy / HTTPS
If you need public HTTPS access to the wg-easy web UI, put it behind a reverse proxy like Nginx Proxy Manager. WireGuard UDP traffic on port 51820 still needs direct routing or port forwarding.