James Liang/Gluetun and Docker Containers

Created Sun, 16 May 2021 23:05:27 -0500 Modified Wed, 27 Oct 2021 00:48:31 +0000
300 Words

The GitHub page for Gluetun provides lots more detail than I’m providing. I suggest you also check out the page.

Setting up Gluetun

I’m running this on my Ubuntu Server with Portainer, Docker, and Docker-Compose installed. To run Gluetun paste the following.

docker run -d --name gluetun --cap-add=NET_ADMIN \
-e VPNSP="protonvpn" -e SERVER_HOSTNAME="server" \
-e OPENVPN_USER=username -e OPENVPN_PASSWORD=password \
-e PORT=443 -e PORT=1194 \
-v /yourpath:/gluetun \
qmcgaw/gluetun

I’m using ProtonVPN, you’ll need your OpenVPN username and password from your VPN provider. You can find a list of the adjustable environment variables on the GitHub Page. If you are using ProtonVPN as well, replace the server with one of the server names. Some examples would be be-03.protonvpn.com or ca-20.protonvpn.com.

Your Gluetun container should be up now. Run docker ps to see if it is running.

Routing Through Gluetun

Port configuration When you go to your Containers in Portainer you should see the Gluetun container. If you need to forward any ports do the following.

Click on your Gluetun Container. Then click Duplicate/Edit.

portainer

Under Network ports configuration, add your ports.

portainer

Under Actions, click Deploy the container and wait for it to deploy.

porainer

Container Routing

Now when you want to route a container through Gluetun go to Duplicate/Edit and change the Network and Container variables.

portainer

Click Deploy the container. The container should now be routing through your VPN provider. To check you can do the following.

Click the Exec Console (rightmost) under the Quick Actions in the Container List.

poratiner

Leave the values at default and click Connect

poratiner

Type in the following:

curl ifconfig.io

It’ll tell you the IP address that the container has. If it is different than your IP address then you are routing through Gluetun!