On this page
- What does wg-easy give you compared with plain WireGuard?
- What do you need before installing?
- How do you write the Compose file?
- How do you start the container and confirm it runs?
- How do you put the admin page behind HTTPS?
- How is the admin password set, and what about PASSWORD_HASH?
- How do you add clients and connect them?
- How do you upgrade and back up wg-easy?
- What goes wrong most often?
- Questions
What does wg-easy give you compared with plain WireGuard?
wg-easy adds a browser page for the jobs you would otherwise do with wg and a text editor: creating clients, showing QR codes, enabling or disabling a device, and watching who is connected. The tunnel underneath is the same kernel WireGuard described in the manual WireGuard guide. It suits people who hand out access to family or colleagues and want a point-and-click way to do it. If you never plan to add more than two or three devices, the plain setup or our WireGuard image is simpler to keep track of.
What do you need before installing?
Prepare an Ubuntu 24.04, Ubuntu 22.04, Debian 12 or Debian 13 server with Docker Engine and the Compose plugin, plus a DNS name for the admin page. Follow the Docker Engine tutorial to install Docker from the official repository, then check it:
docker --version
docker compose versionCreate an A record for vpn.example.net pointing at 198.51.100.24 and an AAAA record pointing at 2001:db8:4f2a::24; the DNS records tutorial walks through it. The name is used twice: by Caddy for the HTTPS certificate, and by clients as the tunnel endpoint.
How do you write the Compose file?
Use the current major release (15) and keep the admin port on the loopback address so only the local reverse proxy can reach it. Make a folder and the file:
sudo mkdir -p /opt/wg-easy && cd /opt/wg-easy
sudo nano compose.yamlservices:
wg-easy:
image: ghcr.io/wg-easy/wg-easy:15
container_name: wg-easy
restart: unless-stopped
networks:
wg:
ipv4_address: 10.42.42.42
ipv6_address: fdcc:ad94:bacf:61a3::2a
ports:
- "51820:51820/udp"
- "127.0.0.1:51821:51821/tcp"
volumes:
- etc_wireguard:/etc/wireguard
- /lib/modules:/lib/modules:ro
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
volumes:
etc_wireguard:The named volume keeps the database, keys and client list across upgrades. The two capabilities let the container create the WireGuard interface and set its own NAT rules, so you do not write any masquerade lines by hand.
How do you start the container and confirm it runs?
Pull and start in the background, then read the log for the listening message:
sudo docker compose up -d
sudo docker compose ps
sudo docker compose logs --tail 30
ss -ltnp | grep 51821
ss -ulnp | grep 51820The TCP check should show 127.0.0.1:51821, never 0.0.0.0:51821. That detail matters because Docker writes its own packet rules ahead of ufw; a port published on all addresses would be reachable from the internet even with ufw set to deny it. Binding to loopback avoids that trap entirely.
How do you put the admin page behind HTTPS?
Caddy obtains and renews a certificate automatically and forwards requests to the loopback port. Install it as shown in the Caddy HTTPS tutorial, then replace /etc/caddy/Caddyfile with:
vpn.example.net {
reverse_proxy 127.0.0.1:51821
}sudo systemctl reload caddy
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw allow 51820/udp
sudo ufw allow OpenSSH
sudo ufw enablePort 80 stays open so the certificate authority can validate renewals. If you want the admin page reachable only from your own address, add @blocked not remote_ip 203.0.113.50 and respond @blocked 403 inside the site block, using your real home IP.
How is the admin password set, and what about PASSWORD_HASH?
In release 15 the password is created in the browser and stored as a hash inside the container database, so it never appears in your Compose file. Open https://vpn.example.net, and the setup wizard asks for an admin username and a long password, then for the public host (vpn.example.net) and port (51820) that client profiles will contain. Use a password manager and at least 16 random characters.
Older guides set a PASSWORD_HASH environment variable; that belongs to release 14. If you deliberately pin ghcr.io/wg-easy/wg-easy:14, generate the bcrypt hash with the helper inside the image and double every dollar sign when pasting it into YAML, because Compose treats a single $ as a variable:
sudo docker run --rm ghcr.io/wg-easy/wg-easy:14 wgpw 'YourLongPassword'
# PASSWORD_HASH=$2a$12$abc... becomes $$2a$$12$$abc... in compose.yamlFor a new install, stay on 15 and skip the variable.
How do you add clients and connect them?
Click New, name the client after the device, and wg-easy creates keys, assigns an IPv4 and IPv6 address and shows a QR code. Scan it with the WireGuard app on a phone, or download the .conf file for a laptop. The client list shows the last handshake and live transfer, and a toggle disables a device without deleting it, which is handy for a lost phone. Under the admin settings you can change the default DNS servers and allowed IPs that new profiles get, for example pointing DNS at your own AdGuard Home resolver.
How do you upgrade and back up wg-easy?
Pull the newer image of the same major version and recreate the container; the volume keeps all state.
cd /opt/wg-easy
sudo docker compose pull
sudo docker compose up -d
sudo docker image prune -fRead the project release notes before moving between major versions, because 14 to 15 changed the configuration model. To keep a copy of keys and clients, export the volume: sudo docker run --rm -v wg-easy_etc_wireguard:/data -v "$PWD":/out alpine tar czf /out/wg-easy.tgz -C /data . and move the archive off the server. Enabling daily backups for the whole instance covers the same data automatically.
What goes wrong most often?
- Profiles point to the wrong endpoint: the host entered in the wizard is baked into every profile. Fix it in the admin settings and re-download the profiles.
- 502 from Caddy: the container is not running or the port mapping changed; check
docker compose ps. - Handshake but no browsing: the host lacks the
ip6table_natoriptable_natmodules after a minimal kernel install; a reboot after updates usually fixes it. - Admin page reachable on 51821 from outside: the port line lost its
127.0.0.1:prefix.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about wg-easy WireGuard web UI
Is wg-easy safe to expose to the internet?
The WireGuard port is safe to expose because it ignores unauthenticated packets. The admin page should only be reached through HTTPS with a strong password, and ideally restricted to your own IP in Caddy.
Can I use wg-easy without a domain name?
Yes, but then the admin page has no trusted certificate. In that case keep it on loopback and reach it through an SSH tunnel: ssh -L 51821:127.0.0.1:51821 deploy@198.51.100.24, then open http://localhost:51821. Release 15 may require INSECURE=true in the environment for plain HTTP access.
Does wg-easy work on Rocky Linux or AlmaLinux?
The container runs anywhere Docker does, but this page covers Ubuntu and Debian, where Docker and ufw behave as described. On Rocky or Alma, add the ports with firewall-cmd instead.
Can I move from a manual WireGuard setup to wg-easy?
Not automatically. Stop the old wg-quick@wg0 unit so the port is free, create the clients again in wg-easy, and send out the new profiles.
Which plan suits wg-easy?
Docker adds a little memory overhead, so a 2 GB plan such as A1-2 gives comfortable headroom. Transfer is the real limit; check 3 TB against your expected use.
More in VPN and private DNS
- WireGuard VPN server (manual setup)
- WGDashboard for WireGuard
- OpenVPN server with easy-rsa
- Pritunl VPN server
- OpenConnect VPN server (ocserv)
- AdGuard Home DNS filter
- Pi-hole DNS sinkhole
- Unbound validating resolver
- Technitium DNS Server
- IPsec VPN with strongSwan
- Squid forward proxy with authentication
- Shadowsocks proxy server
- Authoritative DNS with BIND 9