Route Docker Traffic Through Gluetun

Job ID: 40318595

Budget: $10 – $30 USD

I already have a Gluetun VPN container running smoothly and a separate web-server container that I want to tunnel completely through that VPN. What I need from you is a clean, reproducible Docker-based setup—preferably a single docker-compose.yml—that:

• Spins up Gluetun first,
• Forces every outbound connection from my web-server container to pass exclusively through Gluetun,
• Leaves all other host and container traffic untouched.

Feel free to choose whichever web-server image (Apache, Nginx, Node, etc.) makes testing easiest; I only care that the pattern works so I can swap in my actual image later.

Acceptance is straightforward: when I cURL any external site from inside the web-server container, the public IP reported must match the VPN IP shown in Gluetun, and the same test from the host should still show my regular ISP address.

Please share:

• The docker-compose file (with comments explaining key network settings, dependencies, and environment variables)
• Any additional firewall or iptables tweaks needed—though if you can keep everything self-contained in Docker networking, even better
• A short README or run-through so I can reproduce it on another machine.

No changes are required to Gluetun itself; just wire the networking correctly and show me the proof it works.
Related categories: System Admin Linux Nginx Ubuntu Docker cURL VPN Docker Compose