Is there a way to create a VPN connection that can be used by a docker of my choice?


Go to solution Solved by JonathanM,

Recommended Posts

When creating a new docker, there is an option available for the Network type to use.

I have seen several containers that include the option for a VPN, but what I want is to have a container use a VPN that can be chosen from the "Network type" dropdown. I hope that makes sense.

 

For example, I want to run a docker called "MeTube" by alexta69. This docker creates a web page where I can enter a YouTube video URL and it will download the video to a disk I designate. What I want is for that specific video to be downloaded using a VPN connection and not my regular ISP. I want this to be done only for that specific docker though, not all of the containers I have running.

 

I am using Mullvad, if that makes any difference. I've seen this guide and I followed it until step 4, but then I don't know how to proceed. Then I found this guide that's a bit older, but it refers to a container that supports VPNs whereas mine doesn't (or I can't find how it can).

 

Is this technically possible at all? If it is, any help would be greatly appreciated please.

 

Link to comment

Ok, I've read through quite a few posts to understand how Privoxy works but I am stuck.

I think the best way is to post my docker "run" commands so someone who is experienced can assist please.

 

Run command for alexta69/metube

 

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker create --name='MeTube' -e TZ="UTC" -e HOST_OS="Unraid" -e 'OUTPUT_TEMPLATE'='%(title)s.%(ext)s' -v '/mnt/disks/TRANSIT/':'/downloads':'rw,slave' --user 99:100 --net=container:binhex-privoxyvpn 'alexta69/metube'

 

Run command for binhex-privoxyvpn

 

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker run -d --name='binhex-privoxyvpn' --net='bridge' --privileged=true -e TZ="UTC" -e HOST_OS="Unraid" -e 'VPN_ENABLED'='yes' -e 'VPN_USER'='vpn_username' -e 'VPN_PASS'='vpn_password' -e 'VPN_PROV'='custom' -e 'VPN_CLIENT'='wireguard' -e 'VPN_OPTIONS'='' -e 'LAN_NETWORK'='192.168.1.0/24' -e 'NAME_SERVERS'='84.200.69.80,37.235.1.174,1.1.1.1,37.235.1.177,84.200.70.40,1.0.0.1' -e 'SOCKS_USER'='admin' -e 'SOCKS_PASS'='socks' -e 'ENABLE_SOCKS'='no' -e 'ENABLE_PRIVOXY'='yes' -e 'VPN_INPUT_PORTS'='' -e 'VPN_OUTPUT_PORTS'='' -e 'DEBUG'='false' -e 'UMASK'='000' -e 'PUID'='99' -e 'PGID'='100' -p '8118:8118/tcp' -p '9118:9118/tcp' -p '8081:8081/tcp' -v '/mnt/user/appdata/binhex-privoxyvpn':'/config':'rw' --sysctl="net.ipv4.conf.all.src_valid_mark=1" 'binhex/arch-privoxyvpn'

 

Now, when I run the command

curl ipconfig.io

in the privoxyvpn Console, I am getting the correct IP address (that of Mullvad, not my ISP's).

 

But when I try to run the same command in the metube container, I get the error:

 

sh: curl: not found

 

I found this thread where @starwak3 seems to have the same problem and the first advice from @JonathanM is to "add the port mapping that would normally be on the youtube-dl container to the vpn container", which I think in my case translates to "add the port mapping that would normally be on the metube container to the vpn container". Unfortunately I have minimal experience with docker and I can't understand what this means and what I need to do.

 

Also, I am a bit concerned about the "Extra Parameters" option in the privoxyvpn container. According to SpaceInvader One's video, I need to add the line:

 

--net=container:binhex-privoxyvpn

 

but the container itself had the following already added by default:

 

--user 99:100

 

As you can see in the docker "run" command for the privoxyvpn container I added above, I added both lines one after the other, like this:

 

--user 99:100 --net=container:binhex-privoxyvpn

 

but I am not sure if that is correct and I couldn't find what the correct syntax is if there is more than one parameter to be added

 

 

 

Any help would be greatly appreciated.

Edited by morethanenough
Added MeTube's port to privoxyvpn
Link to comment

Thank you @JonathanM. Yes, it is port 8081.


Did as you said. Here's the run command for binhex-privoxyvpn updated:

 

root@localhost:# /usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker create --name='binhex-privoxyvpn' --net='bridge' --privileged=true -e TZ="UTC" -e HOST_OS="Unraid" -e 'VPN_ENABLED'='yes' -e 'VPN_USER'='vpn_username' -e 'VPN_PASS'='vpn_password' -e 'VPN_PROV'='custom' -e 'VPN_CLIENT'='wireguard' -e 'VPN_OPTIONS'='' -e 'LAN_NETWORK'='192.168.0.0/24' -e 'NAME_SERVERS'='84.200.69.80,37.235.1.174,1.1.1.1,37.235.1.177,84.200.70.40,1.0.0.1' -e 'SOCKS_USER'='admin' -e 'SOCKS_PASS'='socks' -e 'ENABLE_SOCKS'='no' -e 'ENABLE_PRIVOXY'='yes' -e 'VPN_INPUT_PORTS'='8081' -e 'VPN_OUTPUT_PORTS'='' -e 'DEBUG'='false' -e 'UMASK'='000' -e 'PUID'='99' -e 'PGID'='100' -p '8118:8118/tcp' -p '9118:9118/tcp' -p '8081:8081/tcp' -v '/mnt/user/appdata/binhex-privoxyvpn':'/config':'rw' --sysctl="net.ipv4.conf.all.src_valid_mark=1" 'binhex/arch-privoxyvpn'

 

Same issue. After restarting both containers, I tried the curl command on MeTube's console, but got the same result:

 

/app $ curl ipconfig.io
sh: curl: not found
/app $

 

Also, trying to access the WebUI at:

  • 192.168.1.6:8081
  • 192.168.1.6/metube
  • 192.168.1.6:8081/metube

 

None works. When I tried 192.168.1.6/metube it took me to the UNRAID login page (so I think this wouldn't work anyway)

 

 Any ideas?

Edited by morethanenough
Link to comment
Just now, morethanenough said:

Of course I do, that was so silly of me @JonathanM!

Everything works now, except for the "curl ipconfig.io" command.

Since this isn't working, is there a way for me to check if the download is indeed using the vpn or not?

curl isn't installed in the metube container, but you can use traceroute 1.1.1.1 and see the routers the container uses along the way.

  • Like 1
Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.