Docker Wireguard
Appreciate the work of the good folks at linuxserver/docker-wireguard, but I needed more functionality and other existing projects did not meet the criteria.
This project supports Wireguard in a site-to-site configuration.
Usage
I built this to be used with docker-compose
.
See the examples in the examples
directory.
- Use the
docker-compose.local.yml
file to add (shared) general local dependencies/modifications like custom dns servers for the containers. - Copy the
docker-compose.wg0.yml
,wgtest.env
andsample.env
and customize them to fit your use. - Add the relevant
docker-compose.*.yml
to theCOMPOSE_FILE
variable in.env
Manually
Use start
, stop
, or restart
to control the container.
Notes:
- The scripts do routing magic.
- You need to be root for this.
systemd
Copy and adjust the docker-wireguard.service
file to /etc/systemd/system/
, adjust the paths in the file, run the command systemctl enable docker-wireguard
to enable the service, and then run systemctl start docker-wireguard
.
Variables
.env
Variable | Usage |
---|---|
UPNP_ENABLED | Whether upnpc will be called on bringing the containers up |
COMPOSE_FILE | Specify which containers are to be brought up |
Wireguard
Variable | Usage |
---|---|
SERVER_PORT | Wireguard port |
LOCAL_IPS | Wireguard tunnel addresses |
LOCAL_SUBNETS | Inside subnets |
REMOTE_SUBNETS | Remote subnets (specify the tunnel subnet here) |
Peers
Variable | Usage |
---|---|
PEER_X_ADDRESS | Peer outside address |
PEER_X_RESOLVE | Resolve peer through DNS |
PEER_X_PUBKEY | Public key |
PEER_X_PSK | Pre-shared key |
PEER_X_SUBNETS | Peer specific remote subnets |
PEER_X_KEEPALIVE | Keep alive interval |