diff --git a/Dockerfile b/Dockerfile index f4ec33a7..a6c31cb3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,7 +38,7 @@ RUN apk add -U --no-cache \ wireguard-tools \ dumb-init -COPY boringtun-cli /usr/local/sbin/boringtun +COPY --from=leonnicolas/boringtun:alpine /boringtun-cli /usr/local/sbin/boringtun # Expose Ports EXPOSE 51820/udp @@ -46,7 +46,9 @@ EXPOSE 51821/tcp # Set Environment ENV DEBUG=Server,WireGuard -ENV WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun + +# Environment for using boringtun +# ENV WG_QUICK_USERSPACE_IMPLEMENTATION ENV WG_SUDO=1 # Run Web UI diff --git a/README.md b/README.md index 5f1f5b38..8d3e0d5b 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,6 @@ $ docker run -d \ -e WG_HOST=🚨YOUR_SERVER_IP \ -e PASSWORD=🚨YOUR_ADMIN_PASSWORD \ -v ~/.wg-easy:/etc/wireguard \ - -device /dev/net/tun:/dev/net/tun \ -p 51820:51820/udp \ -p 51821:51821/tcp \ --cap-add=NET_ADMIN \ @@ -72,6 +71,34 @@ The Web UI will now be available on `http://0.0.0.0:51821`. > 💡 Your configuration files will be saved in `~/.wg-easy` +#### 2.1 Using boringtun + +This image has builtin [boringtun](https://github.com/cloudflare/boringtun) support for machines with older kernel or limited virtual environments such as OpenVZ. +[boringtun](https://github.com/cloudflare/boringtun) is a userspace wireguard implementation using Rust. It is similar to [wireguard-go](https://git.zx2c4.com/wireguard-go) with a smaller memory footprint. +The TUN device `/dev/net/tun` needs to exist on the host for `boringtun` to work. + +To activate `boringtun` in wg-easy, you need to set the `WG_QUICK_USERSPACE_IMPLEMENTATION` environment variable and mount the `/dev/net/tun` device when running the container. + +
+$ docker run -d \ + --name=wg-easy \ + -e WG_HOST=🚨YOUR_SERVER_IP \ + -e PASSWORD=🚨YOUR_ADMIN_PASSWORD \ + -v ~/.wg-easy:/etc/wireguard \ + -device /dev/net/tun:/dev/net/tun \ + -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 \ + -e WG_QUICK_USERSPACE_IMPLEMENTATION=boringtun + weejewel/wg-easy ++ +Big thanks to leonnicolas for his [boringtun docker image](https://github.com/leonnicolas/boringtun). + ### 3. Sponsor Are you enjoying this project? [Buy me a beer!](https://github.com/sponsors/WeeJeWel) 🍻