docker部署wg-easy和firefly

admin2024-07-03  14

Background

docker部署wg-easy和firefly,在这里插入图片描述,第1张

1.各项目信息

# WireGuard 项目地址
https://github.com/WireGuard
# WireGuard 项目官网
https://www.wireguard.com/

# wg-easy github地址
https://github.com/wg-easy/wg-easy

# firefly github地址
https://github.com/Safe3/firefly

2.wg-easy安装

  • run
  docker run -d \
	  --name=wg-easy \
	  -e LANG=chs \
	  -e WG_HOST=110.110.110.110 \ # 公网IP
	  -e PASSWORD=123456 \ # web界面登录密码
	  -e PORT=51821 \
	  -e WG_PORT=51820 \
	  -v /usr/local/wg-easy/data:/etc/wireguard \
	  -p 51820:51820/udp \
	  -p 51821:51821/tcp \
	  --cap-add=NET_ADMIN \
	  --cap-add=SYS_MODULE \
	  --sysctl="net.ipv4.conf.all.src_valid_mark=1" \
	  --sysctl="net.ipv4.ip_forward=1" \
	  --restart unless-stopped \
	  ghcr.io/wg-easy/wg-easy
  • docker-compose.yml
version: "3.5"
services:
  wg-easy:
    environment:
      - LANG=chs
      - WG_HOST=110.110.110.110
      - PASSWORD=123456
      - PORT=51821
      - WG_PORT=51820
      - WG_DEFAULT_ADDRESS=10.0.0.x
      - WG_DEFAULT_DNS=114.114.114.114
      - WG_MTU=1420
      - WG_ALLOWED_IPS=10.0.0.0/24
      - WG_PERSISTENT_KEEPALIVE=25
      - UI_TRAFFIC_STATS=true
      - UI_CHART_TYPE=2

    image: ghcr.io/wg-easy/wg-easy
    container_name: wg-easy
    volumes:
      - /usr/local/wg-easy/data:/etc/wireguard
    ports:
      - "51820:51820/udp"
      - "51821:51821/tcp"
    restart: unless-stopped
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    sysctls:
      - net.ipv4.ip_forward=1
      - net.ipv4.conf.all.src_valid_mark=1

docker部署wg-easy和firefly,在这里插入图片描述,第2张

3.firefly安装

  • docker-compose.yml
version: '3'
services:
  firefly:
    image: "uusec/firefly:latest"
    container_name: firefly
    devices:
      - /dev/net/tun
    network_mode: host
    volumes:
      - /lib/modules:/lib/modules
      - /etc/firefly:/firefly/conf
    cap_add:
      - NET_ADMIN
      - SYS_MODULE
    restart: unless-stopped
    environment:
      - TZ=Asia/Shanghai
      - FIREFLY_DEVICE=eth0
      - FIREFLY_PASSWORD=firefly
      - FIREFLY_AUTO_SSL=false
      - FIREFLY_PORT=50121

docker部署wg-easy和firefly,在这里插入图片描述,第3张

4.启动异常解决Cannot find device "wg0"

$ wg-quick down wg0
$ wg-quick up wg0
Error: WireGuard exited with the error: Cannot find device "wg0"
This usually means that your host's kernel does not support WireGuard!
    at /app/lib/WireGuard.js:64:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /app/lib/WireGuard.js:62:9

解决方法请参考另一篇文档【Linux内核升级】

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明原文出处。如若内容造成侵权/违法违规/事实不符,请联系SD编程学习网:675289112@qq.com进行投诉反馈,一经查实,立即删除!