Video coming soon…

🔒 Setup Gluetun — Route Any Container Through a VPN

Deploy Gluetun on Ubuntu with Docker — a lightweight VPN client container that connects to your commercial VPN provider and lets you route any other container's traffic through the tunnel, with a control API on port 8223.

⚠️ This script is provided for demo and testing purposes only. Not intended for production use.

📦 Resources & Setup Scripts

Grab the automated bash script from GitHub to follow along with the video.

Automated install script — deploys Gluetun as a VPN client. Set your provider and credentials, then point other containers at it with network_mode: container:gluetun to route their traffic through the VPN.
View on GitHub

Quick Install:

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/vpn/gluetun/gluetun-ubuntu.sh
chmod +x gluetun-ubuntu.sh
sudo bash gluetun-ubuntu.sh

Tutorial Steps

1 Download the Script

wget https://raw.githubusercontent.com/mhmdali94/Docker/main/vpn/gluetun/gluetun-ubuntu.sh

2 Make it Executable

chmod +x gluetun-ubuntu.sh

3 Run the Installer

The script installs Docker if needed and starts Gluetun with the NET_ADMIN capability and the tun device it needs to build a tunnel. You supply your VPN provider and OpenVPN credentials via environment variables; the control API listens on port 8223.

sudo bash gluetun-ubuntu.sh

4 Verify the Tunnel and Route a Container

Check the logs to confirm the VPN connected and see the public IP, then point another container at Gluetun with network_mode so its traffic goes through the tunnel:

docker logs gluetun | grep -i "public ip"

Ports Used

PortPurpose
8223Control API (host → container 8000) — status and public IP
NET_ADMIN + tunRequired to build the VPN tunnel — grant only here
network_modeRoute others with container:gluetun; publish their ports on Gluetun
kill switchBlocks traffic if the tunnel drops — no IP leak

Overview

Why Use It

When You Need It

    Who Should Use It

      Real Use Cases

        Main Features

          How to Use After Installation

            Security Best Practices

              Ports and Firewall Notes

              Backup and Maintenance

                Common Mistakes

                  Troubleshooting

                    Alternatives

                    When Not to Use It

                    PrismaTechWork Professional Help

                      Contact Us

                      Frequently Asked Questions