Run All Your Docker Containers through a VPN

Run All Your Docker Containers through a Gluetun VPN Container

In Docker by dbtech

Today we’ll look at how to setup a Gluetun VPN container and then we’ll setup a couple of other containers to run their internet traffic through that Gluetun container.

You’ll need a VPN provider for this to work. I use PIA for my VPN. Link for that below.

Here’s a link to the command that I run in the video:

Setup Gluetun

Typically what I do is copy a CLI command as shown on that page to a notepad program so that I can make the changes I need to make.

Be sure to change the SPNSP (VPN provider), Region, USER and PASSWORD options to fit your VPN requirements.

Login to your server via SSH as root and paste the modified CLI from the previous step.

Press enter and let the container deploy.

Configuring Apps on Gluetun

Once your VPN container is running, you can start configuring your other containers to run through it.

We’ll use Jackett as an example.

We’ll go into Portainer and select our Jackett container. Click the “Duplicate/Edit” button.

Look down the page a bit and you should see a line with 2 ports. In this case it is 9117. Delete that.

Scroll down and click “Deploy the container”.

Now go back to your Gluetun container and click “Duplicate/Edit”.

Find the spot where you just deleted the port in Jackett and ADD those ports to your Gluetun container. You’ll enter 9117 in both boxes.

Scroll down and click “Deploy the container”.

Now go back to the Jackett container and click “Duplicate/Edit” and scroll down to the “Advanced container settings” and look for “Network.

Change the “Network” option to “container” and the Container option to “gluetun”.

Deploy the container.

Verifying Your VPN Connection

Once that has deployed, you’ll be back on your list of containers in Portainer. Look for the icon that looks like >_ next to your Jackett container.

Click it and then click the “Connect” button on the next page.

You should see a terminal screen.

Type in: curl

Press enter on your keyboard. The returned value should be an IP address from your VPN.

Follow this same process for the rest of the containers you want running through your VPN container.

Here are the extra environmental variables you can use in your setup (including supported providers):

Join this channel to get access to perks:


More Docker Home Server Videos:


Remember to leave a like on this video and subscribe if you want to see more!


Like what I do? Want to be generous and help support my channel? Here are some ways to support:



Here’s my YouTube Merch Store:


Here’s my Amazon Influencer Shop Link:


Follow Me: