Run All Your Docker Containers through a Gluetun VPN Container

dbtechDockerLeave a Comment

Run All Your Docker Containers through a VPN

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:

https://hub.docker.com/r/qmcgaw/gluetun

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 ifconfig.io

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):
https://github.com/qdm12/gluetun/wiki/Environment-variables

Join this channel to get access to perks:
https://www.youtube.com/channel/UCVy16RS5eEDh8anP8j94G2A/join

AFFILIATE LINKS:
PIA VPN: https://dbte.ch/piavpn

More Docker Home Server Videos:
https://www.youtube.com/playlist?list=PLhMI0SExGwfDsoRxRuDeOPPAfedcXFYSZ

/=========================================/

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:

Patreon: https://dbte.ch/patreon
Ko-fi: https://dbte.ch/kofi

/=========================================/

Here’s my YouTube Merch Store:
https://dbte.ch/ytstore

/=========================================/

Here’s my Amazon Influencer Shop Link:
Amazon: https://dbte.ch/amazonshop

/=========================================/

Follow Me:
Twitter: https://dbte.ch/tw
Facebook: https://dbte.ch/fb
Subscribe: https://dbte.ch/ytsub