haugene / docker-transmission-openvpn

Docker container running Transmission torrent client with WebUI over an OpenVPN tunnel
GNU General Public License v3.0
4.16k stars 1.21k forks source link

Running another application (MLDonkey) inside the container under the VPN #662

Closed garret closed 5 years ago

garret commented 5 years ago

I would really like to have another application inside the container so that it can use the advantages of being under the vpn. I was thinking about MLDonkey. I built the container with the default Dockerfile but adding to the end the content taken from this other container -> https://github.com/AngeleToR/docker-mldonkey Everything works but I can see that MLDonkey is not under vpn because the ip is my public one and I can access from outside. Do you know if there is an easy way to do what I am trying to do? Thank you very much in advance.

haugene commented 5 years ago

There is :) You can have containers use the networking of other containers. See: https://docs.docker.com/engine/reference/run/#network-settings

With the network set to container a container will share the network stack of another container. The other container’s name must be provided in the format of --network container:<name|id>.

If the container exposes some ports/web ui, these ports needs to be added to the vpn container instead as it's the one that controls the network. In this mode the two containers can not run processes on the same port as they would collide (as opposed to two regular containers where this would work as long as you bind them to different host ports)

haugene commented 5 years ago

So just to be clear. You shouldn't need to modify the other image. Just run it with --network container:<id|name> and add the port binds to the vpn container.

garret commented 5 years ago

I confirm that is working. I was not expecting to be such easy. Thank you for your fast reply.