Wireguard on Docker Regenerates Keys Every Time I Restart

I have Wireguard set up and working on Docker Desktop for Windows. It came right up and everything worked great immediately.

The issue I have is that it seems to regenerate all my client configs every time restart. After a restart none of my clients work and looking at the configs the keys are obviously different.

Any help would be greatly appreciated.

Post the command you used to create the container

Here is my Docker-Compose:


version: “2.1”
services:
wireguard:
image: ghcr.io/linuxserver/wireguard
container_name: wireguard
cap_add:
- NET_ADMIN
- SYS_MODULE
environment:
- PUID=1000
- PGID=1000
- TZ=America/Los_Angeles
- SERVERURL=clouds.com #optional
- SERVERPORT=51820 #optional
- PEERS=5 #optional
- PEERDNS=auto #optional
- INTERNAL_SUBNET=10.13.13.0 #optional
- ALLOWEDIPS=192.168.1.0/24, 10.13.13.0/24 #optional
volumes:
- /path/to/appdata/config:/config
- /lib/modules:/lib/modules
ports:
- 51820:51820/udp
sysctls:
- net.ipv4.conf.all.src_valid_mark=1
restart: unless-stopped

Replace /path/to/appdata/config with a real path on your host as it will contain all persistent files

Awesome. Much appreciated. Not sure how I missed that…