Cette page est affichée en anglais. Une traduction française est en cours.
ScriptsApr 17, 2026·3 min de lecture

Gluetun — Lightweight VPN Client Container

Gluetun is a thin Docker container that tunnels all traffic through a VPN provider, letting you route any container's network through a secure VPN connection.

Prêt pour agents

Staging sûr pour cet actif

Cet actif est d'abord staged. Le prompt copié demande à l'agent d'inspecter les fichiers staged avant d'activer scripts, config MCP ou config globale.

Stage only · 17/100Policy : staging
Surface agent
Tout agent MCP/CLI
Type
CLI Tool
Installation
Stage only
Confiance
Confiance : Established
Point d'entrée
Gluetun VPN Container
Commande de staging sûr
npx -y tokrepo@latest install 02ce0a83-39f2-11f1-9bc6-00163e2b0d79 --target codex

Stage les fichiers d'abord; l'activation exige la revue du README et du plan staged.

TL;DR
Thin Docker container that routes any container's network traffic through a VPN provider securely.
§01

What it is

Gluetun is a lightweight Docker container that acts as a VPN client, tunneling all network traffic through a supported VPN provider. Instead of configuring VPN clients inside each container, you point other containers at Gluetun's network stack, and all their traffic exits through the VPN tunnel.

This tool is aimed at self-hosters running services like torrent clients, media servers, or privacy-sensitive applications in Docker. Anyone who needs per-container VPN routing without modifying the underlying host network benefits from Gluetun.

§02

How it saves time or tokens

Gluetun eliminates the repetitive work of setting up VPN clients in multiple containers. A single Gluetun instance handles authentication, kill-switch, port forwarding, and DNS leak prevention for every container that shares its network. This consolidation reduces configuration errors and cuts setup time from hours to minutes when managing multiple services behind a VPN.

§03

How to use

  1. Pull the Gluetun Docker image and configure your VPN provider credentials via environment variables
  2. Set network_mode: 'service:gluetun' on any container that should route through the VPN
  3. Start the stack with docker compose up -d and verify the tunnel is active
§04

Example

# docker-compose.yml
services:
  gluetun:
    image: qmcgaw/gluetun
    cap_add:
      - NET_ADMIN
    environment:
      - VPN_SERVICE_PROVIDER=mullvad
      - VPN_TYPE=wireguard
      - WIREGUARD_PRIVATE_KEY=your_key_here
      - SERVER_COUNTRIES=Switzerland
    ports:
      - 8080:8080  # expose app ports here

  myapp:
    image: myapp:latest
    network_mode: 'service:gluetun'
    depends_on:
      - gluetun
§05

Related on TokRepo

§06

Common pitfalls

  • Forgetting cap_add: NET_ADMIN causes the container to fail silently without creating the tunnel
  • Port mappings must go on the Gluetun container, not on the app container using its network
  • Some VPN providers require specific protocol settings; check the Gluetun wiki for your provider's configuration

Questions fréquentes

Which VPN providers does Gluetun support?+

Gluetun supports dozens of providers including Mullvad, NordVPN, Surfshark, PIA, ProtonVPN, Windscribe, and many others. It also supports custom OpenVPN and WireGuard configurations for any provider not explicitly listed.

Does Gluetun have a kill switch?+

Yes. Gluetun blocks all outbound traffic if the VPN tunnel drops, preventing any container from leaking its real IP address. This is enabled by default and requires no additional configuration.

Can I run multiple containers through one Gluetun instance?+

Yes. Any container that sets its network_mode to the Gluetun service shares the VPN tunnel. All their traffic exits through the same VPN connection, and you expose their ports on the Gluetun container.

Does Gluetun support WireGuard?+

Yes. Gluetun supports both OpenVPN and WireGuard protocols. WireGuard generally offers better performance and lower overhead. Set VPN_TYPE=wireguard in your environment variables to use it.

How do I check if the VPN tunnel is working?+

Gluetun exposes a health check endpoint and logs the public IP on startup. You can also exec into a connected container and run 'curl ifconfig.me' to verify the exit IP matches your VPN provider's server.

Sources citées (3)

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires