Skip to content

Regression: --no-pull flag is ignored #1819

@lkho

Description

@lkho

Describe the bug

The global flag --no-pull / WATCHTOWER_NO_PULL is ignored, after the change: 650acde

Diff: 650acde#diff-4dfff1a11759918d8d5a2bbe79ed830bd0df61257fbdd86dafda649787b0b238R314

The client.PullImages check is removed, but the new params passed to container.IsNoPull(params), which is created here https://github.com/containrrr/watchtower/blob/887569f4534952ce5441f29a0c5b0af592bd85ab/cmd/root.go#L361C10-L371 , does not pass through the NoPull flag.

Steps to reproduce

  1. prepare a local docker daemon
  2. build an image with a latest tag e.g. abc:latest
  3. run a container with that tag with name e.g. abc-container
  4. rebuild the new image with the same tag abc:latest, make sure the hash changes
  5. run watchtower docker run --rm --network host containrrr/watchtower --host tcp://localhost:2375 --run-once --no-pull --log-level trace abc-container
  6. see logs
  7. it is still pulling from remote

Expected behavior

it works

Screenshots

No response

Environment

  • Platform: linux
  • Architecture: x64
  • Docker Version: 20.10.23

Your logs

time="2023-10-31T09:33:24Z" level=debug msg="Sleeping for a second to ensure the docker api client has been properly initialized."
time="2023-10-31T09:33:25Z" level=debug msg="Making sure everything is sane before starting"
time="2023-10-31T09:33:25Z" level=info msg="Watchtower 1.6.0"
time="2023-10-31T09:33:25Z" level=info msg="Using no notifications"
time="2023-10-31T09:33:25Z" level=info msg="Only checking containers which name matches \"abc-container\""
time="2023-10-31T09:33:25Z" level=info msg="Running a one time update."
time="2023-10-31T09:33:25Z" level=warning msg="Trace level enabled: log will include sensitive information as credentials and tokens"
time="2023-10-31T09:33:25Z" level=debug msg="Checking containers for updated images"
time="2023-10-31T09:33:25Z" level=debug msg="Retrieving running containers"
time="2023-10-31T09:33:25Z" level=debug msg="Trying to load authentication credentials." container=/abc-container image="abc:latest"
time="2023-10-31T09:33:25Z" level=debug msg="No credentials for index.docker.io found" config_file=/config.json
time="2023-10-31T09:33:25Z" level=debug msg="Got image name: abc:latest"
time="2023-10-31T09:33:25Z" level=debug msg="Checking if pull is needed" container=/abc-container image="abc:latest"
time="2023-10-31T09:33:25Z" level=debug msg="Built challenge URL" URL="https://index.docker.io/v2/"
time="2023-10-31T09:33:25Z" level=debug msg="Got response to challenge request" header="Bearer realm=\"https://auth.docker.io/token\",service=\"registry.docker.io\"" status="401 Unauthorized"
time="2023-10-31T09:33:25Z" level=debug msg="Checking challenge header content" realm="https://auth.docker.io/token" service=registry.docker.io
...
time="2023-10-31T09:33:29Z" level=debug msg="Error pulling image abc:latest, Error response from daemon: pull access denied for abc, repository does not exist or may require 'docker login': denied: requested access to the resource is denied"
time="2023-10-31T09:33:29Z" level=info msg="Unable to update container \"/abc-container\": Error response from daemon: pull access denied for abc, repository does not exist or may require 'docker login': denied: requested access to the resource is denied. Proceeding to next."
time="2023-10-31T09:33:29Z" level=info msg="Session done" Failed=0 Scanned=1 Updated=0 notify=no
time="2023-10-31T09:33:29Z" level=info msg="Waiting for the notification goroutine to finish" notify=no

Additional context

using containrrr/watchtower:1.5.3 has no problem

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions