dependent containers don't work anymore because of network_mode

whenever I try to run a podman container, it’ll through:


<span style="color:#323232;">Error: running container create option: container has joined pod 4f[long_string]b1f and dependency container 34[long_string]9cd is not a member of the pod: invalid argument
</span>

An example of a dependent container compose file looks like this:


<span style="color:#323232;">services:
</span><span style="color:#323232;">  # https://docs.linuxserver.io/images/docker-qbittorrent
</span><span style="color:#323232;">  qbittorrent:
</span><span style="color:#323232;">    image: lscr.io/linuxserver/qbittorrent:latest
</span><span style="color:#323232;">    container_name: qbittorrent
</span><span style="color:#323232;">    environment:
</span><span style="color:#323232;">      - WEBUI_PORT=8090
</span><span style="color:#323232;">      - PUID=0
</span><span style="color:#323232;">      - PGID=0
</span><span style="color:#323232;">    volumes:
</span><span style="color:#323232;">      - ./config:/config:Z
</span><span style="color:#323232;">      - ./files:/media:z
</span><span style="color:#323232;">    restart: always
</span><span style="color:#323232;">    depends_on:
</span><span style="color:#323232;">      - gluetun
</span><span style="color:#323232;">    network_mode: "container:gluetun"
</span>

<span style="color:#323232;">services:
</span><span style="color:#323232;">  # https://github.com/qdm12/gluetun
</span><span style="color:#323232;">  gluetun:
</span><span style="color:#323232;">    image: docker.io/qmcgaw/gluetun
</span><span style="color:#323232;">    container_name: gluetun
</span><span style="color:#323232;">    cap_add:
</span><span style="color:#323232;">      - NET_ADMIN
</span><span style="color:#323232;">    devices:
</span><span style="color:#323232;">      - /dev/net/tun:/dev/net/tun
</span><span style="color:#323232;">    ports:
</span><span style="color:#323232;">      - 8001:8000 # gluetun
</span><span style="color:#323232;">      - 8090:8090 # qbittorrent
</span><span style="color:#323232;">    volumes:
</span><span style="color:#323232;">      - ./config:/gluetun:Z
</span><span style="color:#323232;">    environment:
</span><span style="color:#323232;">      - KEYS=REDACTED
</span><span style="color:#323232;">    restart: always
</span><span style="color:#323232;">    privileged: true
</span>

It worked until yesterday. I updated to fedora 40. I am not sure if that is just a coincidence or if that’s the reason. Should I downgrade to 39?

MangoPenguin,
@MangoPenguin@lemmy.blahaj.zone avatar

Generally to depend on a container it needs to be in the same compose project, so if you move gluetun into the one with qbittorrent it should work fine.

swooosh,

I’ve been running that since many months like that. Why did that break now …

It works in the same file. I don’t want to have 10 containers in the same compose file.

I checked, it works in the same file, thx.

Removing “depends: gluetun” does not work either

Live2day,

But that’s like the whole point of docker compose. If you are just going to have 1 container per file what benefit are you even getting out of using a compose file?

swooosh,

Immich has multiple services running. Having that within one file is good in my opinion. Or nextcloud with an external database.

ElderWendigo,

Docker compose is just a setting file for a container. It’s the same advantage you get using an ssh config file instead of typing out and specifying a user, IP, port, and private key to use each time. What’s the advantage to putting all my containers into one compose file? It’s not like I’m running docker commands from the terminal manually to start and stop them unless something goes wrong, I let systemd handle that. And I’d much rather the systemd be able to individually start, stop, and monitor individual containers rather than have to bring them all down if one fails.

lemmyvore,

You’re attempting to run the qb container in the gluetun network stack. You need to give it time to start. When they’re in the same compose file they can be ordered properly but when they’re different files it doesn’t care.

Check out the full options (long form) to depends: and see if you can add a delay and a health check.

swooosh,

It has worked for months. Thank you. I’ll se what I can do.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • selfhosted@lemmy.world
  • normalnudes
  • DreamBathrooms
  • osvaldo12
  • magazineikmin
  • khanakhh
  • tacticalgear
  • Youngstown
  • mdbf
  • slotface
  • rosin
  • ethstaker
  • Durango
  • kavyap
  • ngwrru68w68
  • megavids
  • InstantRegret
  • cubers
  • modclub
  • everett
  • thenastyranch
  • cisconetworking
  • Leos
  • GTA5RPClips
  • tester
  • vwfavf
  • anitta
  • provamag3
  • JUstTest
  • All magazines