Repository navigation
Getting Started
github-actions[bot] edited this page Nov 1, 2026
·
1 revision
- Docker with
--cap-add=NET_ADMINand--sysctl net.ipv4.ip_forward=1for the container. - A host kernel with WireGuard (Linux 5.6+, or the
wireguarddkms module; load it once withmodprobe wireguardif it is not auto-loaded). Without it, add--device /dev/net/tunand the image falls back towireguard-goautomatically. - UDP port
51820reachable from your devices (port-forward it on your router / cloud firewall).
services:
wireguard:
image: azinchen/wireguard:latest
container_name: wireguard
restart: unless-stopped
cap_add: [NET_ADMIN]
sysctls: [net.ipv4.ip_forward=1]
ports: ["51820:51820/udp"]
environment:
- SERVER_ENDPOINT=vpn.example.com # DNS name or IP your devices dial (port 51820 implied)
- PEERS=alice,bob
volumes:
- ./volumes/config:/etc/wireguarddocker compose up -d
docker compose logs wireguardThe first start generates the server keypair, one keypair + pre-shared key per peer, assigns 10.10.10.2 and 10.10.10.3, and writes alice.conf / bob.conf (plus QR PNGs) under volumes/config/peers/<name>/. Everything is persisted: restarts, upgrades and added peers never change an existing peer's key or address.
docker exec wireguard peer-conf alice --qr # scan in the WireGuard app
docker exec wireguard peer-conf bob > bob.conf # import on a laptop / routerSERVER_ENDPOINT is what ends up in Endpoint =. If you leave it unset the configs carry <SERVER_ENDPOINT>:51820 and the log warns once; fill it in by hand or set the variable.
docker exec wireguard peer-report # state, last handshake, traffic per peer
docker exec wireguard network-diagnostic # routing, kill switch, exit IP per gateway- Prefer a file over the
PEERSvariable, with per-peer options (exit, networks behind the peer, DNS, split tunnel): Peers. - Send peers out through other VPNs or other peers: Gateway Mode and Exit Nodes and Upstreams.
- Use the container as a tunnel for other containers: Sidecar Mode.
wireguard · MIT License · Built on WireGuard + s6-overlay
Setup
Routing
Operating
Under the hood