๐Ÿ” 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


ย  ย 
๐Ÿ“ฆ 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 PrivateKey and *IPv4 Address. So you only set those two values once โ€” the SERVER_` variables decide where it connects.


๐Ÿš€ Quick Start

  1. Open the MOS Hub and search for Gluetun
  2. Enter your WireGuard Private Key and WireGuard Addresses (from a generated Mullvad config)
  3. Optionally adjust SERVER_COUNTRIES / SERVER_CITIES
  4. Ensure /dev/net/tun exists on the host (ls /dev/net/tun)
  5. Click Install
  6. 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:

  1. Note Gluetunโ€™s container name, e.g. gluetun
  2. Deploy the app that should use the VPN (e.g. a torrent client, Sportarr, โ€ฆ)
  3. Run it with network_mode: "container:gluetun" (Compose) or --network=container:gluetun (docker run)
  4. 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
  1. Kill switch = automatic: if the tunnel drops, the firewall inside Gluetun blocks all traffic of connected containers until the VPN reconnects.

๐Ÿงญ Provider Config Examples

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_ADMIN capability (already added via --cap-add=NET_ADMIN in this template) and a working /dev/net/tun. If /dev/net/tun is missing on the host it can usually be created with mkdir -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.


MOS Templates โ€“ maintained by J000K3R

This site uses Just the Docs, a documentation theme for Jekyll.