How to add VPN to qbittirrent container

I have successfully setup a linuxserver/qbittorrent container which runs through a linuxserver/letsencrypt proxy server container.

Now, I would like to protect my qbittorrent container with my VPN service (Private Internet Access).

How would I set this up? Any help is appreciated.

Try adding these variables to the container run command:

  --cap-add=NET_ADMIN \
  -e DOCKER_MODS=taisun/config-mods:pia \
  -e PIAUSER=pmyuser \
  -e PIAPASS=mypassword \
  -e PIAENDPOINT="US New York City" \

A list of the endpoints available can be seen here:
https://www.privateinternetaccess.com/pages/network/

You can confirm PIA is working by issuing:

docker exec qbittorrent curl -sL ifconfig.me

And ensuring it is a PIA IP you see there.

You will also need a host Tun device if that does not already exist: (or simply install openvpn package host level it will take care of creating this for you)

 #!/bin/sh

 # Create the necessary file structure for /dev/net/tun
 if ( [ ! -c /dev/net/tun ] ); then
     if ( [ ! -d /dev/net ] ); then
         mkdir -m 755 /dev/net
     fi
     mknod /dev/net/tun c 10 200
 fi

 # Load the tun module if not already loaded
 if ( !(lsmod | grep -q "^tun\s") ); then
     insmod /lib/modules/tun.ko
 fi

Thanks for your quick response.

Adding these variables to my qbittorrent run command shouldn’t be a problem.
Where should I run the script? Inside the qbittorrent container, or the host?

That script is just an example of how to create the host level tun device, you may allready have one in /dev/net and as I say you can just install openvpn package host level to get one.

host level

tun was already in /dev/net

I added the parameters to my run command.

But I still have a non-PIA IP.

If you have multiple containers you want to route via PIA, have a look here: https://github.com/qdm12/private-internet-access-docker

Thanks for all of the help so far.

I’ve have the PIA container up and running. Now I need help figuring out how to route my qbittorrent traffic through the PIA container. My qbittorent container already uses the --net parameter for reverse proxy with the linuxserver/letsencrypt container.

So now what’s the best way to route through the PIA container?

Thanks again!