Open ronnessim opened 10 months ago
Seems to be related to a commit from october 2023
https://github.com/linuxserver/docker-wireguard/commit/36ca38850c150fa82a068f2543eb26e37919e810
by using this image: linuxserver/wireguard:v1.0.20210914-ls4 it should be working, but in my case i cant connect at the time but this can be related to another problem in my case. I will add info asap
Can confirm that it works with the specified image version of linuxserver.io's wireguard image. If i have time in the future i maybe create a PR for this here but at the moment i don't know anything about go.
Just tested with the image provided above and it survives a restart now. Thanks for the update. I will keep an eye out for this in future releases.
Another solution that worked for me: just mount the config volume to the directory that the linuxserver
container now expects it to be in
version: "3"
services:
wireguard:
image: linuxserver/wireguard:latest
cap_add:
- NET_ADMIN
volumes:
- - config:/config
+ - config:/config/wg_confs
ports:
- "51820:51820/udp"
...
Disclosure: I'm not familiar enough with Wireguard or wireguard-ui
to know if there are any bad implications to moving the whole mount point for the config directory
Ignore this, don't do this. It doesn't work - I was just lucky.
Another solution that worked for me: just mount the config volume to the directory that the
linuxserver
container now expects it to be inversion: "3" services: wireguard: image: linuxserver/wireguard:latest cap_add: - NET_ADMIN volumes: - - config:/config + - config:/config/wg_confs ports: - "51820:51820/udp" ...
Disclosure: I'm not familiar enough with Wireguard or
wireguard-ui
to know if there are any bad implications to moving the whole mount point for the config directory
Are you using this config yourself? linuxserver/wireguard:latest creates the subfolders coredns, templates and wg_confs, which means mounting with - config:/config/wg_confs will create the path /config/wg_confs/wg_confs. If youre going to move the mount point, then you should at least do it for the wireguard-ui container, not the wireguard container. Also. i tried, but did not make it work...
Two solutions that worked for me:
config/wg0.conf
config/wg0.conf > config/wg_confs/wg0.conf
Apparently wireguard-ui can be configured to point to a different configuration file, in the case of the subdirectory wg_confs
you should set it up like this (In docker-compose):
...
services:
wireguard-ui:
environment:
- WGUI_CONFIG_FILE_PATH=/etc/wireguard/wg_confs/wg0.conf
...
Although I've had issues with this environment variable not being picked up with some reason, so I'm just using a symlink at the moment.
We are usng the latest docker version of wireguard from dockerhub (super basic config, most things left as default except for passwords). The first time the container starts file, creates an empty DB and we can add some connections via the GUI and apply them. Then when we do docker compose down, and then up, we see that all tunnels are down in the log. The only way to fix it is to remove config/wg0.conf and then restart, edit a connection and then apply the config to regenerate a valid config. Here is the log output after a restart:
The problem is likely that the config is also being added to config/wg_confs so it exists twice.