Skip to content

Link detection/depends-on label not working as documented #1579

@XanderStrike

Description

@XanderStrike

Describe the bug

With regular old containers (not docker-compose) the depends-on label is not respected.

I see some other closed issues around this with conflicting comments so maybe this is a docs issue?

Steps to reproduce

Given a container named nginx-proxy:

$ docker ps | grep proxy
6f8813d1ffde   nginxproxy/nginx-proxy:latest             "/app/docker-entrypo…"   6 hours ago     Up 6 hours     0.0.0.0:80->80/tcp, 0.0.0.0:443->443/tcp      nginx-proxy

I launch nginx-proxy-acme-companion:

$ docker run --detach \
    --name nginx-proxy-acme \
    --volumes-from nginx-proxy \
    --volume /var/run/docker.sock:/var/run/docker.sock:ro \
    --volume acme:/etc/acme.sh \
    --env "DEFAULT_EMAIL=example@example.com"  \
    --label=com.centurylinklabs.watchtower.depends-on=nginx-proxy   \
    nginxproxy/acme-companion

When the scheduled upgrade happens, Watchtower does not respect the label:

time="2023-03-07T03:12:16-08:00" level=info msg="Stopping /nginx-proxy (929e5352ca7f) with SIGTERM"
time="2023-03-07T03:12:28-08:00" level=info msg="Stopping /nginx-proxy-acme (3f07b4fdd421) with SIGTERM"
time="2023-03-07T03:12:29-08:00" level=info msg="Creating /nginx-proxy-acme"
time="2023-03-07T03:12:29-08:00" level=error msg="Error response from daemon: No such container: nginx-proxy"
time="2023-03-07T03:12:29-08:00" level=info msg="Creating /nginx-proxy"

It also did this before I put the label on it. I'm not sure if volumes-from is the kind of link the documentation is talking about watchtower being able to detect automatically. In either case, this shows the behavior did not change based on the label:

time="2023-02-28T03:12:48-08:00" level=info msg="Stopping /nginx-proxy (c4a8f5ce168d) with SIGTERM"
time="2023-02-28T03:13:02-08:00" level=info msg="Stopping /nginx-proxy-acme (3d64a76059a7) with SIGTERM"
time="2023-02-28T03:13:03-08:00" level=info msg="Creating /nginx-proxy-acme"
time="2023-02-28T03:13:03-08:00" level=error msg="Error response from daemon: No such container: nginx-proxy"
time="2023-02-28T03:13:03-08:00" level=info msg="Creating /nginx-proxy"

Expected behavior

Watchtower waits for nginx-proxy to come up before restarting nginx-proxy-acme

Screenshots

No response

Environment

Docker version 20.10.12, build 20.10.12-0ubuntu2~20.04.1

Your logs

I've relaunched watchtower with debug mode on, the next time both nginx-proxy and nginx-proxy-acme update on the same night I'll come back and add the logs.

time="2023-03-07T09:25:30-08:00" level=debug msg="Sleeping for a second to ensure the docker api client has been properly initialized."
time="2023-03-07T09:25:31-08:00" level=debug msg="Making sure everything is sane before starting"
time="2023-03-07T09:25:31-08:00" level=debug msg="Retrieving running containers"
time="2023-03-07T09:25:32-08:00" level=debug msg="There are no additional watchtower containers"
time="2023-03-07T09:25:32-08:00" level=debug msg="Watchtower HTTP API skipped."
time="2023-03-07T09:25:32-08:00" level=info msg="Watchtower 1.5.3"
time="2023-03-07T09:25:32-08:00" level=info msg="Using notifications: discord"
time="2023-03-07T09:25:32-08:00" level=info msg="Checking all containers (except explicitly disabled with label)"
time="2023-03-07T09:25:32-08:00" level=info msg="Scheduling first run: 2023-03-08 03:10:00 -0800 PST"
time="2023-03-07T09:25:32-08:00" level=info msg="Note that the first check will be performed in 17 hours, 44 minutes, 27 seconds"

Additional context

No response

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