this post was submitted on 10 Nov 2026
11 points (92.3% liked)

Selfhosted

63722 readers
798 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:

Detailed Rules Post

  1. Be civil.

  2. No spam.

  3. Posts are to be related to self-hosting.

  4. Don't duplicate the full text of your blog or readme if you're providing a link.

  5. Submission headline should match the article title.

  6. No trolling.

  7. Promotion posts require active participation, with an account that is at least 30 days old. F/LOSS without a paywall has exceptions, with requirements. See the rules link for details. Tags [CBH] or [AIP] are required, see the links in Rule 8 for details.

  8. AI-related discussions and AI-involved promotional posts have additional requirements for tagging, as noted in Rule 7 and the AI & Promotional Post Expanded Rules post, and find example disclosures here.

Resources:

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

Questions? DM the mods!

founded 3 years ago
MODERATORS
 

I use gluetun, my arr stack and bittorrent client in a single docker-compose. I use the syntax

    depends_on:
      gluetun:
        condition: service_healthy

in the stack to make sure that the bittorrent client doesn't try to connect too early. All that works great.

I also use that same VPN connection for other containers too (not in the same docker-compose stack). I do that by simply using network_mode: "container:gluetun" in the second yaml file. But I'd like to use the same depends_on syntax. But it errors out because gluetun is undefined in the second stack.

So my question is, how do I make sure the containers in docker compose stack 2 start after docker compose stack 1 (the one with gluetun) is healthy?

you are viewing a single comment's thread
view the rest of the comments
[–] lemmyvore@feddit.nl 4 points 3 hours ago

You can't use dependencies cross-stack.

If you know the IP that the gluetun interface is supposed to have you tell the BT client to use that interface as output interface. Usually BT clients have this option, other apps might not.

Another thing you can do is wrap the client in a script that waits for the interface to be up (respond to ping) before it moves one. Something like (in sh):

while ! ping -c 1 -q -W 1 "$IP" &>/dev/null ; do
    echo "Waiting for ${IP} to come up..."
    sleep 5
done
# run BT client here

Alternatively if the gluetun interface itself doesn't respond to ping, you can ping something else (like 1.1.1.1) through the interface, and use the -I ${IP} option for ping to bind to it for output.