Docker Community Forums

Share and learn in the Docker community.

Connect VM in VPN docker container

Hi,

i have a vpn docker container, (misioslav/surfshark) it works perfectly but I would like to know how to connect a vm to this docker so that its network traffic goes through the vpn.

cara i try to connect my vm on the same network as the vpn and set the ip of the vpn as gateway in my vm but it does not work …

Thanks for your help :slight_smile:

Generally speaking containers should be used to implement services available to external applications (an APIs service, or a runtime, or a dbms, or something like that).

According to this, what you could achieve is a set of services available for you on different containers, and a single container working as SSH tunnel gateway, making your local environment connected to it using SSH and defining a set of local and remote SSH ports forwarding, with different policies according to the service/port and the IP of the service.

It should work for all the services, and you haven’t to use a socks proxy to forward requests to different hosts: using remote SSH forwarding your SSH endpoint will redirect your requests to the right service inside the local/private lan. I found that this guide describes correctly how to work with local&remote port forwarding.

http://www.debianadmin.com/howto-use-ssh-local-and-remote-port-forwarding.html

About the OpenVPN solution, as you already know it is not possible to use software requiring privileged mode on containers, because it couldn’t be allowed on Bluemix due to security reasons: if you wish to have this kind of solution I strongly suggest you to use OpenVPN on a VM on Bluemix UK region (still beta but an architecture expected to be the final architecture as soon as VM service will become GA service)

I think that these options are the ones available on Bluemix to achieve what you describe without using the VPN service suggested by @bill-wentworth

what i want to do is just pass network traffic from my vm through my docker so i didn’t understand your ssh story

ignore lewish95, judged by the content of the posts from the last months… it is is safe to say its a bot.

Read the doku of the image on dockerhub and check wether it provides something like a http or proxy proxy. This is a problem directly related to the image. Worst case: ask the maintainer

ok, yes I suspected it was a bot

no normally there is no proxy as it is just a vpn but suddenly to connect my vm to the container must just add a proxy between the two?