Skip to content
This repository was archived by the owner on Dec 17, 2025. It is now read-only.
This repository was archived by the owner on Dec 17, 2025. It is now read-only.

Dependent containers are not shutdown or restarted #595

Description

@kje1

Describe the bug
I recently commented on #504 (comment) which has now been closed as the suggested fix was to use the com.centurylinklabs.watchtower.depends-on label for dependent containers. I have done this but unfortuantely this is still not working for me. Today my vpn container updated and a service which uses the vpn container for it's network, was initially not shut down but also not restarted again after the vpn image was updated. To solve this I have to destroy the dependent container and recreate it as the container ID of the vpn changes after an update.

As you can see below, I have both depends_on and the com.centurylinklabs.watchtower.depends-on label setup on the dependent container but there is nothing in the logs indicating that watchtower did anything with this containers.

Am I using the label wrong by any chance?

To Reproduce
Steps to reproduce the behavior:

  1. Container A with dependency link to container B
  2. Watchtower updates container B

Expected behavior

  1. Container A should be stoppped
  2. Container B should be updated and restarted
  3. Container A should be restarted and connect to new container B

Docker Compose
Extract from docker compose file...

#WatchTower
  watchtower:
   image: containrrr/watchtower
   hostname: watchtower
   container_name: watchtower
   restart: always
   volumes:
    - /var/run/docker.sock:/var/run/docker.sock
   command: --interval "3600" --cleanup --debug
   environment:
    - TZ=${TZ}

#vpn        
  vpn:
    image: dperson/openvpn-client
    container_name: vpn
    # cap_add, security_opt, and volume required for the image to function
    cap_add:
      - net_admin
    environment:
      - TZ=Europe/London
      - FIREWALL=""
    networks:
      - default
    dns:
      - 8.8.8.8
      - 8.8.4.4
    read_only: true
    tmpfs:
      - /tmp
      - /run
    restart: always
    security_opt:
      - label:disable
    stdin_open: true
    tty: true
    volumes:
      - /dev/net:/dev/net:z
      - ${USERDIR}/docker/vpn:/vpn
    ports:
      - "XXXX:XXXX"

#Ombi
  ombi:
   image: linuxserver/ombi
   container_name: ombi
   restart: always
   volumes:
    - ${USERDIR}/docker/ombi:/config
    - ${USERDIR}/docker/shared:/shared
   environment:
    - PUID=${PUID}
    - PGID=${PGID}
    - TZ=${TZ}
   network_mode: service:vpn
   depends_on:
    - vpn
   labels:
    - "com.centurylinklabs.watchtower.depends-on=vpn"

Logs from running watchtower with the --debug option

time="2020-07-07T15:00:25+01:00" level=info msg="Stopping /vpn (bef6f210ff074c07efcce051ca1980f12bf1b4eddc5e6a16800b9d78b45de6c9) with SIGTERM"
time="2020-07-07T15:00:31+01:00" level=debug msg="Removing container bef6f210ff074c07efcce051ca1980f12bf1b4eddc5e6a16800b9d78b45de6c9"
time="2020-07-07T15:00:31+01:00" level=info msg="Creating /vpn"
time="2020-07-07T15:00:31+01:00" level=debug msg="Starting container /vpn (1acd36abab38d472c93b26c8d914a42a94f5ad25fde70478866721286814a368)"
time="2020-07-07T15:00:32+01:00" level=info msg="Removing image sha256:2403135f134b336da433a70a127d88f24a831463ad7c17a2ad1a3bbe1c376226"
time="2020-07-07T15:00:32+01:00" level=debug msg="Scheduled next run: 2020-07-07 16:00:01 +0100 BST"

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions