-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Running without network mode host #156
Comments
Hi there, I tried to run them in their respective container with both of them linked by network_mode="host" but it does not seem to work entirely since i can't add new peers : error 500 "failed to prepare new peer: failed to get available IP addresses: no more available address from cidr". So i'd like to give your method a try. I'm using portainer to "manage" my container and more precisely the "stacks" option to copy paste docker compose file. Thanks for the hardwork everyone have put into making this app and thanks for your futur help :) |
Actually, after correctly reading the custom scripts from linuxserver your protocol was straight forward. I can't find anything about it :( any idea ? Edit: Solved it by changing the cidr range of the ip address server from x.x.x.1/32 to x.x.x.1/24 |
I just linked networks of both containers:
|
@karstennilsen are you exposing a shared volume for |
@joestump did you find an answer to that? |
Here're two ansible playbooks I've used to setup Wireguard and WG-Portal to work together, works flawlessly, WG-Portal was even able to import existing Wireguard peers, the only thing needed to update is peers' private key. ---
- name: Wireguard
hosts: application
gather_facts: false
tasks:
- name: Network
community.docker.docker_network:
name: wireguard-network
driver: overlay
attachable: true
- name: Volume
community.docker.docker_volume:
name: wireguard-data
- name: Container
community.docker.docker_container:
name: wireguard
image: lscr.io/linuxserver/wireguard:latest
capabilities:
- NET_ADMIN
- SYS_MODULE
env:
PUID=1000
PGID=1000
TZ=<desired TZ>
SERVERURL=<ip or host name>
PEERS=1
mounts:
- source: wireguard-data
target: /config
type: volume
- source: /lib/modules/
target: /lib/modules/
type: bind
ports:
- 51820:51820/udp
- 8123:8123
sysctls:
net.ipv4.conf.all.src_valid_mark: "1"
networks:
- name: wireguard-network
userns_mode: host
restart_policy: always - name: WG Portal
hosts: application
gather_facts: false
tasks:
- name: Volume
community.docker.docker_volume:
name: wg-portal-data
- name: Container
community.docker.docker_container:
image: wgportal/wg-portal:v1
name: wg-portal
restart_policy: always
capabilities:
- NET_ADMIN
network_mode: container:wireguard
volumes:
- wireguard-data:/etc/wireguard
- wg-portal-data:/app/data
env:
EXTERNAL_URL=http://<ip or host name>:8123
ADMIN_USER=<admin user name>
ADMIN_PASS=<admin pass>
WG_CONFIG_PATH=/etc/wireguard/wg_confs # this bit is important
userns_mode: host My swarm setup works in |
Also, default configs shall be added:
|
First of all thank you for the awesome project. I wanted to share my setup running wg-portal without
network_mode: host
. As answered here and here this project needs to have access to thewg0
interface to properly run.I run wireguard with the
linuxserver/wireguard
container and I'm installingwg-portal
in the same container using their custom scripts. Here's how it looks like:Then in
docker-compose.yml
To install wg-portal in
wireguard-porta-install.sh
And then in
wireguard-portal.sh
to runIn the container logs there should be some errors which is wireguard-portal trying to init before wg0 is created, but right after it the server should be up and running.
As far as I'm aware the only drawback is that not running wg-portal in a container makes it harder to keep updated with something like
Watchtower
, but it was a requirement for me to run wg-portal behind traefik which is not in network_mode: host.Created an issue since I'm not sure this is README-worthy, but let me know if there's any other way to do this or any other cons I'm missing.
Thanks!
The text was updated successfully, but these errors were encountered: