Skip to content

Instantly share code, notes, and snippets.

@andrew-stclair
Created December 12, 2021 12:42
Show Gist options
  • Select an option

  • Save andrew-stclair/8e63772c2d6118e504ecde33dc5bd830 to your computer and use it in GitHub Desktop.

Select an option

Save andrew-stclair/8e63772c2d6118e504ecde33dc5bd830 to your computer and use it in GitHub Desktop.

UI in docker container

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

On VPN Host (Must be VM or bare metal, or if container, must have systemd enabled)

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}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment