this post was submitted on 07 Oct 2025
39 points (100.0% liked)
Selfhosted
60024 readers
705 users here now
A place to share alternatives to popular online services that can be self-hosted without giving up privacy or locking you into a service you don't control.
Rules:
-
Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.
-
No spam.
-
Posts here are to be centered around self-hosting. Please ensure it is clear in your post how it relates to self-hosting.
-
Don't duplicate the full text of your blog or git here. Just post the link for folks to click.
-
Submission headline should match the article title.
-
No trolling.
Resources:
- selfh.st Newsletter and index of selfhosted software and apps
- awesome-selfhosted software
- awesome-sysadmin resources
- Self-Hosted Podcast from Jupiter Broadcasting
Any issues on the community? Report it using the report flag.
Questions? DM the mods!
founded 3 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
network_modeis only for multiple containers in the same stack.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".You could also route it manually. That's a more advanced solution, but it's more convenient than the
network_modeapproach. More on this here: https://discuss.tchncs.de/post/19039498Oooooooooooo I totally was confused. Thank you for this!!!!
Amazing this worked great!!!
One question though; How do I get qbittorrent to auto reconnect if gluetun gets restarted? (currently checking public ip per above fails if gluetun gets restarted, and the only way to fix is by restarting qbittorrent.)
This is an annoying quirk in the way docker handles networking between containers and I couldn't find a good solution for this issue when I was trying out
network_mode. I just couldn't find a way to set docker up to automatically restart the dependent container. You can achieve this with services defined in the same stack (usingdepends_on), but I don't know if it's possible with your current setup.That's why I mentioned manual routing in my other reply. It's annoying to set up, but more convenient because you avoid having to manage restarts (or figuring out how to get docker to do it, which may not be possible in this case).