Skip to content

Conversation

@DonDebonair
Copy link
Contributor

docker.image(...) will now check if the image exist and only pull when required. It uses the following logic for this:

  1. If force == True it will always pull the image
  2. If an exact digest is provided, it will pull if there is no image with the same registry + repo + name + digest
  3. If a tag is provided and the tag is latest, it will always pull
  4. If a tag is provided and it is not latest, it will pull if no image exists with the same registry + repo + name + tag

It offloads most of this logic to Docker itself, by relying on the DockerImage fact, which in turn uses docker image inspect to figure out if an image with name + tag or digest exists.

  • Pull request is based on the default branch (3.x at this time)
  • Pull request includes tests for any new/updated operations/facts
  • Pull request includes documentation for any new/updated operations/facts
  • Tests pass (see scripts/dev-test.sh)
  • Type checking & code style passes (see scripts/dev-lint.sh)

`docker.image(...)` will now check if the image exist and only pull when required.
It uses the following logic for this:

1. If `force == True` it will always pull the image
2. If an exact digest is provided, it will pull if there is no image with the same registry + repo + name + digest
3. If a tag is provided and the tag is `latest`, it will always pull
4. If a tag is provided and it is not `latest`, it will pull if no image exists with the same registry + repo + name + tag

It offloads most of this logic to Docker itself, by relying on the `DockerImage` fact, which in turn uses `docker image inspect`
to figure out if an image with name + tag or digest exists.
@DonDebonair DonDebonair force-pushed the feat/docker-image-idempotent branch from f53e0f9 to a251eed Compare October 25, 2025 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant