docker-compose.yml
version: "3"
services:
wg:
image: ngoduykhanh/wireguard-ui:latest
container_name: wgui
cap_add:
- NET_ADMIN
network_mode: host
environment:
- TZ=Australia/Melbourne
- WGUI_USERNAME=admin
- WGUI_PASSWORD=admin
logging:
driver: json-file
options:
max-size: 50m
ports:
- 5000:5000
volumes:
- ./db:/app/db
- /etc/wireguard:/etc/wireguard
Follow this to install wireguard
https://wireguard.how/server/debian/
Make the following files
/etc/systemd/system/wgui.path
[Unit]
Description=Watch /etc/wireguard/wg0.conf for changes
[Path]
PathModified=/etc/wireguard/wg0.conf
[Install]
WantedBy=multi-user.target
/etc/systemd/system/wgui.service
[Unit]
Description=Restart WireGuard
After=network.target
[Service]
Type=oneshot
ExecStart=/bin/bash -c "/usr/bin/wg-quick down wg0 && /usr/bin/wg-quick up wg0"
Enable and start the service to reload configs in wireguard
sudo systemctl enable wgui.{path,service}; sudo systemctl start wgui.{path,service}