Files
deploy.stack/WireGuardVPN/wg-easy/stack.yml
cnphpbb 01cfafa78f fix(WireGuardVPN): 添加必要的内核模块和网络配置
添加/lib/modules只读挂载以支持WireGuard内核模块
增加IPv4和IPv6相关网络配置参数确保网络转发正常工作
2025-12-14 15:58:19 +08:00

33 lines
1.2 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
## RUN:: docker compose -p wg-easy --env-file ./WireGuardVPN/wg-easy/env.cfg -f ./WireGuardVPN/wg-easy/stack.yml up -d
services:
wg-easy:
image: ${IMAGE_TAG}
container_name: wg-easy
environment:
# [!] 重要改成你的服务器的公网IP或域名
- WG_HOST=${WG_HOST}
# [!] 重要设置一个强密码来登录Web UI
- PASSWORD=${WG_PASSWORD}
# 可选修改Web UI的端口容器内是51821映射到主机可自定义
#- WG_PORT=51820
#- WEB_PORT=51821
volumes:
# [!] 关键将容器内的WireGuard配置目录映射到主机
- ${Volumes_Path}/data:/etc/wireguard
- /lib/modules:/lib/modules:ro
ports:
# 将WireGuard的端口映射到主机必须与你原来的端口一致通常是51820
- "51820:51820/udp"
# 将Web UI的端口映射到主机
- "51821:51821/tcp"
cap_add:
- NET_ADMIN
- SYS_MODULE
sysctls:
- net.ipv4.ip_forward=1
- net.ipv4.conf.all.src_valid_mark=1
- net.ipv6.conf.all.disable_ipv6=0
- net.ipv6.conf.all.forwarding=1
- net.ipv6.conf.default.forwarding=1
restart: unless-stopped