this post was submitted on 07 Oct 2025
39 points (100.0% liked)

Selfhosted

53408 readers
357 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:

  1. Be civil: we're here to support and learn from one another. Insults won't be tolerated. Flame wars are frowned upon.

  2. No spam posting.

  3. Posts have to be centered around self-hosting. There are other communities for discussing hardware or home computing. If it's not obvious why your post topic revolves around selfhosting, please include details to make it clear.

  4. Don't duplicate the full text of your blog or github here. Just post the link for folks to click.

  5. Submission headline should match the article title (don’t cherry-pick information from the title to fit your agenda).

  6. No trolling.

  7. No low-effort posts. This is subjective and will largely be determined by the community member reports.

Resources:

Any issues on the community? Report it using the report flag.

Questions? DM the mods!

founded 2 years ago
MODERATORS
 

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/)

you are viewing a single comment's thread
view the rest of the comments
[–] CumBroth@discuss.tchncs.de 9 points 2 months ago* (last edited 2 months ago) (6 children)

You could use network_mode: "container:{name}" instead of service:{name}. See here https://docs.docker.com/reference/compose-file/services/#network_mode

Service definitions have to be defined in the same compose file or merged into one file at some point in order to be able to reference each other. Containers don't have that restriction.

[–] Dust0741@lemmy.world 2 points 2 months ago (4 children)

network_mode is only for multiple containers in the same stack.

[–] CumBroth@discuss.tchncs.de 15 points 2 months ago* (last edited 2 months ago) (3 children)

Uhh, I think you might be confused. Let me explain a bit more:

  1. Services and Containers aren't the same thing. The distinction usually doesn't matter in typical self-hosting scenarios, but in this case it does.

In short: Services are what you define in a compose file; Containers are what you spin up based on those service definitions.

  1. network_mode is a service attribute and it can be defined for each service separately.
  2. 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.
  3. network_mode: "container:{name}" can freely reference any preexisting container. This helps you achieve what you want. You can define your gluetun container independently, along with any services you might want to be part of the same stack, and give it a unique identifier using container_name: myIndependentGluetun. After spinning it up, run your Qbittorrent container or whatever service you want to route through the gluetun container after adding network_mode: "container:myIndependentGluetun".

You could also route it manually. That's a more advanced solution, but it's more convenient than the network_mode approach. More on this here: https://discuss.tchncs.de/post/19039498

[–] Dust0741@lemmy.world 7 points 2 months ago

Oooooooooooo I totally was confused. Thank you for this!!!!

load more comments (2 replies)
load more comments (2 replies)
load more comments (3 replies)