๐ Gluetun
![]()
Gluetun is a VPN client in a single, lightweight Docker container supporting many providers (Mullvad, ProtonVPN, NordVPN, ExpressVPN, โฆ) over WireGuard or OpenVPN. It ships with a built-in kill switch and firewall โ containers routed through Gluetun are automatically blocked the moment the tunnel drops, so no traffic ever leaks outside the VPN.
๐ท๏ธ Category: Network / VPN
๐ณ Image: qmcgaw/gluetun:latest
๐ Links
| ย | ย |
|---|---|
| ๐ฆ Project | github.com/qmcgaw/gluetun |
| ๐ Support | GitHub Issues |
| ๐ Docs | github.com/qmcgaw/gluetun-wiki |
๐ Ports
Gluetun is a gateway, not a service โ the real benefit comes from routing other containers through it (see Usage below). It does, however, expose proxy ports you can reach from the LAN or from routed apps:
| Port | Protocol | Purpose |
|---|---|---|
8888 | TCP | HTTP proxy |
1080 | TCP | SOCKS5 proxy |
๐ก If a media app needs a port reachable from the LAN while going through the VPN (e.g. a torrent WebUI), expose that port on Gluetun instead of on the app itself.
๐พ Volumes
| Host Path | Container Path | Mode | Description |
|---|---|---|---|
/mnt/cache/appdata/gluetun | /gluetun | RW | Gluetun configuration and helper scripts. |
โ๏ธ Environment Variables
๐ Connection
| Variable | Default | Masked | Description |
|---|---|---|---|
VPN_SERVICE_PROVIDER | mullvad | โ | VPN provider. Supported: mullvad, protonvpn, nordvpn, expressvpn, private internet access, surfshark and many more. |
VPN_TYPE | wireguard | โ | Protocol: wireguard or openvpn. |
WIREGUARD_PRIVATE_KEY | (empty) | โ | Your WireGuard PrivateKey (base64). Pull it from a generated Mullvad config file. Identical for all Mullvad servers. |
WIREGUARD_ADDRESSES | (empty) | โ | Your WireGuard IP in CIDR (e.g. 10.64.222.21/32). From the generated Mullvad config. Identical for all Mullvad servers. |
SERVER_COUNTRIES | Austria,Germany,Switzerland | โ | Comma-separated countries to connect to (picked randomly). |
SERVER_CITIES | Vienna,Graz,Frankfurt,Munich,Zurich | โ | Comma-separated cities to connect to. |
TZ | Europe/Vienna | โ | Container timezone. |
๐ก Mullvad tip: every Mullvad server config shares the same
PrivateKeyand *IPv4 Address. So you only set those two values once โ theSERVER_` variables decide where it connects.
๐ Quick Start
- Open the MOS Hub and search for Gluetun
- Enter your WireGuard Private Key and WireGuard Addresses (from a generated Mullvad config)
- Optionally adjust
SERVER_COUNTRIES/SERVER_CITIES - Ensure
/dev/net/tunexists on the host (ls /dev/net/tun) - Click Install
- Verify the tunnel: open the container logs for a line like
VPN service ready, or check the assigned public IP.
๐ Usage โ routing other containers through the VPN
Gluetun is a gateway, so the actual benefit comes from sending other apps through it:
- Note Gluetunโs container name, e.g.
gluetun - Deploy the app that should use the VPN (e.g. a torrent client, Sportarr, โฆ)
- Run it with
network_mode: "container:gluetun"(Compose) or--network=container:gluetun(docker run) - Configure the appโs proxy / DNS via the
[IP]:[PORT]endpoints Gluetun exposes:
| Endpoint | Purpose |
|---|---|
8888 | HTTP proxy |
1080 | SOCKS5 proxy |
8388 | Shadowsocks (if enabled) |
53 | DNS-over-TLS to your VPN provider |
- Kill switch = automatic: if the tunnel drops, the firewall inside Gluetun blocks all traffic of connected containers until the VPN reconnects.
๐งญ Provider Config Examples
Mullvad (WireGuard) โ recommended
| Variable | Value |
|---|---|
VPN_SERVICE_PROVIDER | mullvad |
VPN_TYPE | wireguard |
WIREGUARD_PRIVATE_KEY | *your private key* |
WIREGUARD_ADDRESSES | 10.64.222.21/32 |
SERVER_COUNTRIES | Austria |
Mullvad lets multiple devices share one config (same key + address).
ProtonVPN (WireGuard)
| Variable | Value |
|---|---|
VPN_SERVICE_PROVIDER | protonvpn |
VPN_TYPE | wireguard |
WIREGUARD_PRIVATE_KEY | *your private key* |
SERVER_COUNTRIES | Switzerland |
NordVPN (OpenVPN)
| Variable | Value |
|---|---|
VPN_SERVICE_PROVIDER | nordvpn |
VPN_TYPE | openvpn |
OPENVPN_USER | *service username* |
OPENVPN_PASSWORD | *service password* (masked) |
SERVER_COUNTRIES | Austria |
๐งช Image Tags
| Tag | Purpose |
|---|---|
latest | Latest stable build (recommended) |
vX.Y.Z | Pinned release |
sha-โฆ | Development / nightly builds |
โ ๏ธ NET_ADMIN + TUN required: Gluetun needs the
NET_ADMINcapability (already added via--cap-add=NET_ADMINin this template) and a working/dev/net/tun. If/dev/net/tunis missing on the host it can usually be created withmkdir -p /dev/net && mknod /dev/net/tun c 10 200 && chmod 600 /dev/net/tun.
๐ก Tip: After a server/container restart Gluetun randomly re-picks a server from your
SERVER_COUNTRIES/SERVER_CITIESโ perfect for rotating to a healthy node if the โno public IP after restartโ issue appears.
๐ Verify it works:
docker exec gluetun sh -c "wget -qO- https://api.ipify.org"should return the VPNโs public IP, not your home IP.
๐ For more information: See the Gluetun Wiki for the full list of providers, OpenVPN credentials and advanced firewall settings.