I use following docker-compose.yml for my copyright troll protection. Without going into much details it has 1 container named pia_gluetun that serves as a vpn connection of other containers. Another container is called pia_deluge, and it along with all the rest of containers depends on pia_gluetun.
So far so good. Now all the other containers have various depends_on settings in order to ensure the network + data source containers start before the media server containers.
However last 3 reboots I ended up with all of the containers started (presumably in correct order as they all work with no warning of missing services), apart form the pia_deluge one which ends up stopped, with no logs - indicating it for w/e reason didn't even bother trying to start (i think?). Subsequently starting it works perfectly ok.
version: '3.7'
services:
  gluetun:
    image: qmcgaw/private-internet-access
    container_name: pia_gluetun
    cap_add:
      - NET_ADMIN
    network_mode: bridge
    ports:
      - 8888:8888/tcp # HTTP proxy
      - 8388:8388/tcp # Shadowsocks
      - 8388:8388/udp # Shadowsocks
      - 8000:8000/tcp # Built-in HTTP control server
# other containers ports
      - 8112:8112     # deluge webui
      - 58846:58846   # deluge daemon
      - 6767:6767     # bazarr
      - 8989:8989     # sonarr
      - 7878:7878     # radarr
      - 8686:8686     # lidarr
      - 9117:9117     # jackett
      - 8191:8191     # flaresolverr
      - 4040:4040     # airsonic
      - 8096:8096     # jellyfin
      - 8227:8227     # pyload
    volumes:
      - ./data_gluetun:/gluetun
      - ./data_gluetun/port_forward:/tmp/gluetun/forwarded_port
    environment:
      - VPNSP=private internet access
      - TZ=${TIMEZONE}
      - USER=${PIA_USER}
      - PASSWORD=${PIA_PASS}
      - REGION=${PIA_REGION}
      - PORT_FORWARDING=on
      - FIREWALL_OUTBOUND_SUBNETS=192.168.1.0/24
      - HTTPPROXY=on
#      - HTTPPROXY_USER=${PROXY_USER}
#      - HTTPPROXY_PASSWORD=${PROXY_PASS}
      - SHADOWSOCKS=on
      - SHADOWSOCKS_PASSWORD=${SHADOW_PASS}
    restart: unless-stopped
  pyload:
    image: linuxserver/pyload
    container_name: pia_pyload
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TIMEZONE}
    volumes:
      - ./config_pyload:/config
      - /shares/_Download:/downloads
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
  deluge:
#    image: linuxserver/deluge
    build: ./deluge_my_image
    container_name: pia_deluge
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TIMEZONE}
      - DELUGE_LOGLEVEL=INFO #optional
    volumes:
      - ./config_deluge:/config
      - /shares/media/_downloads:/downloads
#      - /shares/media:/media
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
  jackett:
    image: linuxserver/jackett
    container_name: pia_jackett
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TIMEZONE}
    volumes:
      - ./config_jackett:/config
      - /shares/media/_downloads:/downloads
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
      - flaresolverr
  flaresolverr:
    container_name: pia_flaresolverr
    image: 'ghcr.io/flaresolverr/flaresolverr:latest'
    environment:
      - LOG_LEVEL=info
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
  lidarr:
    image: linuxserver/lidarr
    container_name: pia_lidarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TIMEZONE}
    volumes:
      - ./config_lidarr:/config
      - /shares/media:/media
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
      - jackett
      - deluge
  radarr:
    image: linuxserver/radarr
    container_name: pia_radarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TIMEZONE}
    volumes:
      - ./config_radarr:/config
      - /shares/media:/media
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
      - jackett
      - deluge
  sonarr:
    image: linuxserver/sonarr:preview
    container_name: pia_sonarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TIMEZONE}
    volumes:
      - ./config_sonarr:/config
      - /shares/media:/media
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
      - jackett
      - deluge
  bazarr:
    image: linuxserver/bazarr
    container_name: pia_bazarr
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TIMEZONE}
    volumes:
      - ./config_bazarr:/config
      - /shares/media:/media
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
      - sonarr
      - radarr
  airsonic:
    image: airsonicadvanced/airsonic-advanced:latest
    container_name: pia_airsonic
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TIMEZONE}
      - 'JAVA_OPTS=-Xmx1024m -Xms1024m'
    volumes:
      - ./config_airsonic:/var/airsonic
      - /shares/media/music:/var/music
      - ./playlists_airsonic:/var/playlists
      - ./podcasts_airsonic:/var/podcast
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
  jellyfin:
    image: linuxserver/jellyfin
    container_name: pia_jellyfin
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=${TIMEZONE}
    volumes:
      - ./library_jellyfin:/config
      - /shares/media:/media
      - /shares/Dokumenty:/mnt/Dokumenty
#    devices:
#      - /dev/dri/renderD128:/dev/dri/renderD128
#    network_mode: "host"
    network_mode: "service:gluetun"
    restart: unless-stopped
    depends_on:
      - gluetun
In my (admittedly shallow) understanding of the matter if the pia_deluge container doesn't start, shouldn't that prevent sonarr, radarr, lidarr from starting as well?
How can I adjust my docker-compose.yml to ensure desired start order? I previously tried having the vpn container as separate container outside the stack, which messed up with tho containers routed through it something fierce everytime I recreated it.
Many thanks for any insights!
