I would like to run Gluetun in its own compose.yaml file, and run qbittorrent in its own compose.yaml file. I want to use the vpn connection Gluetun makes for qbittorrent.
Does anyone have examples of this working? I’ve been messing with the containers, and different docker networks can I cannot get it working.
(my test has been running docker exec -it qbittorrent curl -s https://ifconfig.me/)
CumBroth@discuss.tchncs.de 3 weeks ago
You could use
network_mode: “container:<name>”instead ofservice:<name>. See here docs.docker.com/reference/compose-file/services/#…lem@lemmy.world 3 weeks ago
I have gluetun and qbittorrent running separately and this works for me.
Dust0741@lemmy.world 3 weeks ago
network_modeis only for multiple containers in the same stack.CumBroth@discuss.tchncs.de 2 weeks ago
Uhh, I think you might be confused. Let me explain a bit more:
ServicesandContainersaren’t the same thing. The distinction usually doesn’t matter in typical self-hosting scenarios, but in this case it does.In short:
Servicesare what you define in acomposefile;Containersare what you spin up based on those service definitions.network_modeis a service attribute and it can be defined for each service separately.network_mode: “service:{name}”requires the service being referenced to be part of the same stack. This is probably what you were thinking of when you wrote this reply.network_mode: “container:{name}” can freely reference any preexisting container. This helps you achieve what you want. You can define yourgluetuncontainer independently, along with any services you might want to be part of the same stack, and give it a unique identifier usingcontainer_name: myIndependentGluetun. After spinning it up, run yourQbittorrentcontainer or whatever service you want to route through thegluetuncontainer after addingnetwork_mode: “container:myIndependentGluetun”.