容器必须加 NET_ADMIN 能力并挂载 /dev/net/tun,否则无法建立 VPN;需自行填写对应服务商的账号密码或 WireGuard 私钥;Mullvad 仅支持 WireGuard,部分服务商需用 custom provider 配置 WireGuard。
gluetun
passtequeMIT活跃维护把 VPN 客户端塞进轻量 Docker 容器,统一支持多家 VPN 服务商,内置 OpenVPN/WireGuard、DNS over TLS 和代理服务器,方便容器流量安全出网。
VPN client in a thin Docker container for multiple VPN providers, written in Go, and using OpenVPN or Wireguard, DNS over TLS, with a few proxy servers built-in.
docker run -d --cap-add=NET_ADMIN --device /dev/net/tun -p 8888:8888/tcp -e VPN_SERVICE_PROVIDER=ivpn -e VPN_TYPE=openvpn -e OPENVPN_USER= -e OPENVPN_PASSWORD= qmcgaw/gluetunREADME 未说明显存或 GPU 要求;镜像基于 Alpine 3.23,体积 43.1MB,兼容 amd64、i686、ARM 64/32 位 v6/v7 及 ppc64le。
轻量 Docker 容器里的多供应商 VPN 客户端,让容器流量统一走 VPN
把 VPN 客户端塞进轻量 Docker 容器,统一支持多家 VPN 服务商,内置 OpenVPN/WireGuard、DNS over TLS 和代理服务器,方便容器流量安全出网。
核心能力
- 支持 20+ 家 VPN 服务商,OpenVPN 全支持
- WireGuard 支持内核态与用户态两种实现
- 内置 DNS over TLS 与恶意域名/IP 拦截
- 内置防火墙 kill switch 只放行 VPN 流量
- 自带 Shadowsocks、Socks5、HTTP 代理服务器
容易踩的坑
- v3.41.3最新正式版2026-07-30 · 2026-07-30 14:48 UTC
This fixes a VPN server port forwarding deadlock bug introduced whilst back-porting a fix from the
masterbranch (:latestimage) tov3.41.2. Credits to @robinostlund for reporting the bug and even nailing down what it was! (#3416)Refer to v3.41.2 fixes in case you haven't checked.
- v3.41.22026-07-29 · 2026-07-29 11:19 UTC
查看更新说明
⚠️ there is a deadlock bug in the port forwarding if you use the up or down command, I will release v3.41.3 shortly
Fixes
- Wireguard:
- support IPv6 address formatting from config files (#3273)
- ignore empty address strings
- skip tun device checks when using kernelspace
- OpenVPN:
- bundle provider CA certificates in one block (#3258)
- trim spaces in config lines before parsing (#3327)
- fix support for
tcp-client- always use
proto tcp-clientwhen using TCP - parses
tcp-client(on top oftcp,tcp4,tcp6) as meaning TCP
- always use
- Custom openvpn: restrict custom openvpn config protocol to tcp or udp internally
- Firewall: shared mutex for both iptables and ip6tables to prevent race conditions
- Healthcheck:
- correct behavior when HEALTH_RESTART_VPN=off and startup check fails
- prevent race condition on the healthchecker (#3400)
- DNS:
- skip blocking if block lists download fails
- correct error wrapping for DNS listening address validation
- DNS over TLS pool behavior fixed
- handle timed out connections the same as closed connections
- close connection on TLS handshake failure
- improve mutex handling during connection renewal and retrieval
- VPN port forwarding:
- no longer stuck after failed port forwarding
- handle empty ports without panicing
- Updater: only uses DoH to cloudflare+google
- prevent dns plaintext manipulation both the periodic update and when running in cli mode
- possibly higher reliability on poor connections versus UDP
- drop
-dnsflag in update command - for now no configuration allowed since it makes everything rather complex
- Control server:
- use
portandportsfor both single port and multiple ports forwarded - authentication: return 404 or 405 depending on route
- use
- Increase global http client timeout to 35s and precise lower timeouts where needed
- Fix DNS blocklists slow downloads
- Leave 35s timeout for updaters
- Set timeouts to 1s for local calls
- Set timeouts to 5s for LAN VPN calls and small external calls
- Set timeouts to 10s external VPN API calls
- Kernel modules: probe searches for features built-in the kernel
- CI: set hash of PR commit instead of synthetic commit in docker build argument
internal/command: fix rare race condition on log line stream at command completion
Provider specific fixes
- AirVPN: update servers data (#3186)
- ExpressVPN:
- add new CA3 certificate to fix TLS handshake failure (#3184, #3192)
- remove pakistan server
- Privado:
- servers data updated using JSON API
- allow OpenVPN TCP protocol
- allow additional OpenVPN ports 443, 8080 and 8443 for both tcp and udp
- Private Internet Access:
- remove none encryption preset
- use AES-GCM for all presets
- allow ports 501 and 502 as custom ports given they are the defaults
- try x.y.128.1 and x.y.0.1 from the gateway IP to find the API IP address
- fix servers data updater and update servers data
- update default OpenVPN ports: 8080 for UDP, 8443 for TCP (according to https://github.com/pia-foss/manual-connections/commit/8a75e46be81583d17f9ab3570881419b35000969)
- handle "port is busy" messages and retry port forwarding logic
- ProtonVPN: fix updater code
- Vyprvpn: update OpenVPN configs zip URL (#3264)
PS:
- No time to make a video or a rant section yet, but will do for v3.42.0 for sure!
- v3.42 probably coming end of August/early September!
- Sorry for the spam, first few v3.41.2 release attempts decided to give me a bunch of surprises in the CI, so here it is again
- Wireguard:
- v3.41.12026-02-11 · 2026-02-11 14:17 UTC
查看更新说明
Fixes
- Healthcheck: prevent race condition making Gluetun hang completely (#3123)
- Wireguard kernelspace detection fixed in some cases
- OpenVPN 2.5 is not needed as long as it's not to be used, resolving some kernel incompatibilities
- HTTP proxy: remove info log when no Proxy-Authorization header is present
- ProtonVPN:
- update OpenVPN settings (#3120)
- support port 51820 for UDP OpenVPN connections
- v3.41.02025-12-25 · 2025-12-25 00:38 UTC
查看更新说明
Video of me reading out this release
Thank you all for your patience for this release which took its sweet time 🙏⏲️
I have been rather absent in a good part of 2025 due to work and life getting in the way, and I would like to thank many of you for helping out around in issues and discussions, and for the few code contributors whilst I was away.
On this release, many of the features you see are the result of behind-the-scene work of the last few years (notably on dns) and I'm super glad they are finally in Gluetun! A lot more to come in v3.42.0, there is already a pile of pull requests waiting 🚀
Final note, introducing the RANTING SECTION at the bottom of this changelog. This section might also be in the future releases (unfortunately)!
Happy holidays! 🎄 🎅 ❄️ ⛄
Features
- DNS
- (K8s users read this) Local network names resolution using private DNS resolvers found at container start (#2970)
- DNS over HTTPS support (see
DNS_UPSTREAM_RESOLVER_TYPEbelow) DNS_UPSTREAM_RESOLVER_TYPEoption which can bedot(DNS over TLS),doh(DNS over HTTPS) orplain(plaintext over UDP)- DNS over TLS re-uses TCP connections which should put less stress on TCP-connections-rate-limiting by the VPN server
- DNS requests blocked are logged with a reason
- DNS rebinding protection is always enabled, but hostnames can be excluded with
DNS_REBINDING_PROTECTION_EXEMPT_HOSTNAMES i/o timeouterrors are now logged at the debug level instead of warn level
- healthcheck system reworked: more robust and less impact on other applications (#2923)
- Three checks are performed:
- startup full check: when the VPN connection is first established, perform a TCP+TLS dial to
HEALTH_TARGET_ADDRESSESwith a timeout of 6 seconds - periodic full check: every 5 minutes, perform a TCP+TLS dial to
HEALTH_TARGET_ADDRESSES, with up to 3 tries of 10s, 15s, and 30s timeouts - periodic small check: every minute, perform ICMP pings to
HEALTH_ICMP_TARGET_IPS, with a fallback to plain DNS (UDP) lookups ofgithub.comto cloudflare+google, with up to 10 tries of 5s, 5s, 5s, 10s, 10s, 10s, 15s, 15s, 15s, and 30s timeouts
- startup full check: when the VPN connection is first established, perform a TCP+TLS dial to
- If any of these checks fail, the VPN connection is restarted
- Reduced impact on TCP to allow for higher bandwidth in TCP torrenting
- New option
HEALTH_TARGET_ADDRESSES=cloudflare.com:443,github.com:443to have a fallback address - New option
HEALTH_ICMP_TARGET_IPS=1.1.1.1,8.8.8.8to have8.8.8.8as a fallback address - New option
HEALTH_SMALL_CHECK_TYPEwhich can bednsoricmp. By default it uses icmp and falls back to dns if icmp isn't permitted. - New option
HEALTH_RESTART_VPN: you should really leave it toon, unless you have trust issues with the healthcheck.
- Three checks are performed:
- built-in servers data updates:
- Cyberghost
- ExpressVPN
- Mullvad
- Privado
- Private Internet Access
- SlickVPN (mere 29 hardcoded servers 🤷)
- ProtonVPN
- Surfshark
- Torguard
- control server:
HTTP_CONTROL_SERVER_AUTH_DEFAULT_ROLEoption (JSON encoded). For example:{"auth":"basic","username":"me","password":"pass"}or{"auth":"apiKey","apikey":"xyz"}or{"auth":"none"}.- log number of roles read from auth file
- VPN server side port forwarding:
- support
{{PORT}}template variable on top of{{PORTS}} - support
{{VPN_INTERFACE}}template variable which is by defaulttun0
- support
- Public IP data fetcher queries all data sources in parallel and picks the most popular result
- bump Alpine from 3.20 to 3.22
- wireguard: on error parsing
WIREGUARD_ENDPOINT_IP, mention it must be an IP address for the time being - new ascii logo logged out at program exit... did any of you spot it? 👀
Fixes
- Wireguard:
- DNS
- v3.40.42025-12-24 · 2025-12-24 03:25 UTC
查看更新说明
Fixes
- DNS:
- prevent restart crash if
DOT=offandDNS_KEEP_NAMESERVER=off - retry on next period the blocklists update after a failed update
- prevent restart crash if
WIREGUARD_ENDPOINT_IPoverrides the IP address correctly (regression introduced in v3.39.0)- ExpressVPN hardcoded servers data updated (#2888 - huge thanks to the manual work of @Lobstrosity)
- PureVPN OpenVPN configuration updated (from #2991, credits to @mlapaj)
- SlickVPN updater: only keep 11 servers hardcoded and drop website scraping code
- VPNSecure updater fixed, with region and city data allowed to be set to
N / A - VPN Unlimited updater: no longer valid hardcoded hosts removed
- DNS:
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Gluetun VPN client
Lightweight swiss-army-knife-like VPN client to multiple VPN service providers
⚠️ This and gluetun-wiki are the only websites for Gluetun, other websites claiming to be official are scams ⚠️
🗯️ this repository will be migrated to github.com/passteque/gluetun on 2026-05-21, which is a Github organization under my sole control, so don't get alarmed if you get redirected in the coming days 😉 Reason being migrating Github sponsors to the Open source collective due to my personal situation, basically annoying paperwork. On the plus side, it will be more transparent and funds donated will only be used for the project. The Docker image names will remain the same.
Quick links
-
Problem?
- Check the Wiki common errors and faq
- Start a discussion
- Fix the Unraid template
-
Suggestion?
-
Happy?
- Sponsor me on github.com/sponsors/qdm12
- Donate to paypal.me/qmcgaw
- Drop me an email
-
Want to add a VPN provider? check the development page and add a provider page
-
Video:
Features
- Based on Alpine 3.23 for a small Docker image of 43.1MB
- Supports: AirVPN, Cyberghost, ExpressVPN, FastestVPN, Giganews, HideMyAss, IPVanish, IVPN, Mullvad (Wireguard only), NordVPN, Privado, Private Internet Access, PrivateVPN, ProtonVPN, PureVPN, SlickVPN, Surfshark, TorGuard, VPNSecure.me, VPNUnlimited, Vyprvpn, Windscribe servers
- Supports OpenVPN for all providers listed
- Supports Wireguard both kernelspace and userspace
- For AirVPN, FastestVPN, Ivpn, Mullvad, NordVPN, ProtonVPN, Surfshark and Windscribe
- For Cyberghost, Private Internet Access, PrivateVPN, PureVPN, Torguard, VPN Unlimited and VyprVPN using the custom provider
- For custom Wireguard configurations using the custom provider
- More in progress, see #134
- Supports AmneziaWG only with the custom provider for now
- DNS over TLS baked in with service provider(s) of your choice
- DNS fine blocking of malicious/ads hostnames and IP addresses, with live update every 24 hours
- Choose the vpn network protocol,
udportcp - Built in firewall kill switch that only allows traffic through the VPN, to the VPN server, and to allowed LAN devices
- Built in Shadowsocks proxy server (protocol based on SOCKS5 with an encryption layer, tunnels TCP+UDP)
- Built in Socks5 proxy server (tunnels TCP+UDP) - partial credits to @angelakis and @adjscent
- Built in HTTP proxy (tunnels HTTP and HTTPS through TCP)
- Connect other containers to it
- Connect LAN devices to it
- Compatible with amd64, i686 (32 bit), ARM 64 bit, ARM 32 bit v6 and v7, and even ppc64le 🎆
- Custom VPN server side port forwarding for Private Internet Access, PrivateVPN and ProtonVPN
- Possibility of split horizon DNS by selecting multiple DNS over TLS providers
- Can work as a Kubernetes sidecar container, thanks @rorph
Setup
🎉 There are now instructions specific to each VPN provider with examples to help you get started as quickly as possible!
Go to the Wiki!
Here's a docker-compose.yml for the laziest:
---
services:
gluetun:
image: qmcgaw/gluetun
# container_name: gluetun
# line above must be uncommented to allow external containers to connect.
# See https://github.com/qdm12/gluetun-wiki/blob/main/setup/connect-a-container-to-gluetun.md#external-container-to-gluetun
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun:/dev/net/tun
ports:
- 8888:8888/tcp # HTTP proxy
- 8388:8388/tcp # Shadowsocks
- 8388:8388/udp # Shadowsocks
volumes:
- /yourpath:/gluetun
environment:
# See https://github.com/qdm12/gluetun-wiki/tree/main/setup#setup
- VPN_SERVICE_PROVIDER=ivpn
- VPN_TYPE=openvpn
# OpenVPN:
- OPENVPN_USER=
- OPENVPN_PASSWORD=
# Wireguard:
# - WIREGUARD_PRIVATE_KEY=wOEI9rqqbDwnN8/Bpp22sVz48T71vJ4fYmFWujulwUU=
# - WIREGUARD_ADDRESSES=10.64.222.21/32
# Timezone for accurate log times
- TZ=
# Server list updater
# See https://github.com/qdm12/gluetun-wiki/blob/main/setup/servers.md#update-the-vpn-servers-list
- UPDATER_PERIOD=
🆕 Image also available as ghcr.io/qdm12/gluetun
