Skip to main content

1. How to Install

Wireguard is new VPN technology that provides super fast and encrypt access to another network. The setup I will be showing is ideal to implement on a VPS, for changing your Public IP address when browsing the internet from home, or it can be ideal setup for tunneling into your trusted home network

Prerequisites:
  • Have the latest docker installed (Obviously)
  • Make sure your distribution OS supports wireguard
How to install:
  1. To install, first open your portainer instance, and log in.
  2. Navigate to stacks, and click on Add Stack
  3. Then, copy and paste the following into the stack:
version: '3.3'
services:
    wg-easy:
        container_name: wg-easy
        environment:
            - 'WG_HOST=wg.kv.uk.eu.org' # enter domain name that points to Wireguard Instance
            - 'PASSWORD=123456789' # change this to a secure password
            - 'WG_PORT=64443' # Enter the external docker port. In this case it is 64443
            - 'WG_PERSISTENT_KEEPALIVE=25'
        volumes:
            - 'wg-easy:/etc/wireguard' #changes this to a mounted volume from host if you want to persist configuration
        ports:
            - '64443:51820/udp' # this port exposes the wireguard tunnel port 
            - '51821:51821/tcp' # this port exposes the wg-easy UI
        restart: unless-stopped
        image: weejewel/wg-easy
        cap_add:
          - NET_ADMIN
        devices:
          - "/dev/net/tun:/dev/net/tun"
        
volumes:            #Use this if you don't care about persisting your install
  wg-easy:
    driver: local

4. Then click on Deploy Stack, and wait for a few minutes while it deploys

5. Navigate to http://<ipaddress>:51821 to add new devices

And with that you have succesfully configured a wireguard container for VPN access!