When Watchtower updates VPN container it breaks containers dependent on it

I have a stack with a Transmission-OpenVPN container that in turn gives network access to a bunch of other containers. All works fine. Recently I’ve installed Watchtower but an issue I’ve ran into is that when the image for the VPN is updated and one of the dependent containers is then stopped it cannot restart itself - Exit Code 128 - the reason being that it appears to be trying to reference the old VPN container’s network. Manually this is as simple as setting the network to the new version of the VPN container on the dependent, or simply restarting the entire stack.

But obviously this defeats the entire purpose of automating updates with Watchtower, and the solution of excluding the VPN container from automatic updates likewise is avoiding the issue rather than solving it.

What options do I have - I thought about adding a cron job on the machine to restart the stack about an hour after Watchtower does its weekly update check, but I run into the same issue with the dependents not having the correct network if I try to start/stop/restart.

Is there a command line equivalent of the stop/start stack in Portainer? If there was I could just run it in a cron job and automate this headache. I’ve seen talk about Edge jobs elsewhere but even if I make an Edge group of my stack for the sole purpose of a cron job I’m not sure what, or even if there is any, command I can run to automate this annoyance.

I’ve researched this issue extensively this weekend and no one really has an exact answer. Any help is much appreciated.

I’m running Portainer 2.9.0. My docker-compose:

services:
 transmission-openvpn:
    volumes:
        - /srv/dev-disk-by-uuid-f838e6cd-29d5-4011-bb25-041f95d8e52a/data/appdata/transmissionVPN/data/:/data
        - /srv/dev-disk-by-uuid-f838e6cd-29d5-4011-bb25-041f95d8e52a/data/appdata/transmissionVPN/config:/config
        - /etc/localtime:/etc/localtime:ro
    environment:
        - PUID=1000
        - PGID=1000
        - CREATE_TUN_DEVICE=true
        - OPENVPN_PROVIDER=PIA
        - OPENVPN_CONFIG=spain
        - OPENVPN_USERNAME=******
        - OPENVPN_PASSWORD=*******
        - OPENVPN_OPTS=--inactive 3600 --ping 10 --ping-exit 60
        - WEBPROXY_ENABLED=false
        - LOCAL_NETWORK=192.168.68.0/24
        - TRANSMISSION_SCRAPE_PAUSED_TORRENTS_ENABLED=false
    dns:
        - 8.8.8.8
        - 8.8.4.4
    cap_add:
        - NET_ADMIN
    logging:
        driver: json-file
        options:
            max-size: 10m
    ports:
        - 9091:9091
        - 9117:9117
        - 7878:7878
        - 8989:8989
        - 8686:8686
        - 5299:5299
        - 5076:5076
    restart: always
    image: haugene/transmission-openvpn:latest
    container_name: transmission-openvpn
    labels:
        - com.centurylinklabs.watchtower.enable="true"
        - com.centurylinklabs.watchtower.depends-on="jackett,radarr,sonarr,lidarr,lazylibrarian,hydra2"

 jackett:
    image: linuxserver/jackett
    container_name: jackett
    network_mode: "service:transmission-openvpn"
    environment:
        - PUID=1000
        - PGID=1000
        - TZ=Europe/London
        - AUTO_UPDATE=true #optional
        - RUN_OPTS=#optional
    volumes:
        - /srv/dev-disk-by-label-datadisk/appdata/jackett:/config
        #Jackett only needs config
    restart: unless-stopped
 
 radarr:
    image: linuxserver/radarr
    network_mode: "service:transmission-openvpn"
    container_name: radarr
    environment:
        - PUID=1000
        - PGID=1000
        - TZ=Europe/London
        - UMASK_SET=022 #optional
    volumes:
        - /srv/dev-disk-by-label-datadisk/appdata/radarr:/config
        - /srv/dev-disk-by-label-datadisk/media:/media
    restart: unless-stopped
 
 sonarr:
    image: linuxserver/sonarr
    network_mode: "service:transmission-openvpn"
    container_name: sonarr
    environment:
        - PUID=1000
        - PGID=1000
        - TZ=Europe/London
        - UMASK_SET=022 #optional
    volumes:
        - /srv/dev-disk-by-label-datadisk/appdata/sonarr:/config
        - /srv/dev-disk-by-label-datadisk/media/:/media
    restart: unless-stopped
 
 lidarr:
    image: linuxserver/lidarr
    network_mode: "service:transmission-openvpn"
    container_name: lidarr
    environment:
        - PUID=1000
        - PGID=1000
        - TZ=Europe/London
        - UMASK_SET=022 #optional
    volumes:
        - /srv/dev-disk-by-label-datadisk/appdata/lidarr:/config
        - /srv/dev-disk-by-label-datadisk/media/:/media
    restart: unless-stopped
 
 lazylibrarian:
    image: linuxserver/lazylibrarian
    network_mode: "service:transmission-openvpn"
    container_name: lazylibrarian
    environment:
        - PUID=1000
        - PGID=1000
         - TZ=Europe/London
        #- DOCKER_MODS=linuxserver/calibre-web:calibre #optional
    volumes:
        - /srv/dev-disk-by-label-datadisk/appdata/lazylibrarian/config:/config
        - /srv/dev-disk-by-label-datadisk/media:/media
        - /srv/dev-disk-by-label-datadisk/appdata/lazylibrarian/books:/books
    restart: unless-stopped

 hydra2:
    image: ghcr.io/linuxserver/nzbhydra2
    network_mode: "service:transmission-openvpn"
    container_name: hydra2
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/London
    volumes:
      - /srv/dev-disk-by-label-datadisk/appdata/hydra2/config:/config
    restart: unless-stopped

Anyone? I’m stuck at this point and would appreciate some input.