Can I use a docker container to route only 1 program through a VPN?

WeirdGoesPro@lemmy.world to Linux 101 stuff. Questions are encouraged, noobs are welcome!@lemmy.world – 2 points –

I am running Ubuntu Server with Plex, qBittorrent-Nox, and CyberGhost. I want to route qBittorrent through the CyberGhost VPN, but not Plex.

I have never used Docker, but from what I gather online, it seems like the containers operate like little VM’s for compartmentalization and resource allocation. If that is correct, would I be able to put qBittorrent-Nox and CyberGhost into the same docker container to route qBittorrent-Nox through the VPN while Plex runs outside the VPN in its own snap?

Thanks for the help!

1

A bit of a late reply, just found this community!

I use https://hub.docker.com/r/qmcgaw/gluetun for my VPN container and https://hub.docker.com/r/linuxserver/qbittorrent for qbittorrent. In the qbittorrent compose file I added network_mode: "container:gluetun" and in the qbittorrent webgui I bound it to tun0 for my network interface. If you prefer a GUI to compose files, DBTech has a nice video using Portainers GUI to set it up https://www.youtube.com/watch?v=xbSfaKwyfXE alternative invidious link https://www.yewtu.be/watch?v=xbSfaKwyfXE