-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Perma diff in check mode when referencing image tag + digest #790
Comments
What happens is that the module things the image does not exists, and tries to pull it. Outside of check mode, it notices that after pulling the image equals the image before pulling, and reports The main problem here is that having both a tag and a digest is not really supported by the module. It only handles either having the tag or the digest. |
BTW, please note that if you specify both tag + digest, that Docker pretty much ignores the tag. If you for example run I guess this is also something we can implement for this collection, though I very much dislike this behavior since you can forgot to update the tag after updating the digest without noticing, which makes having the tag specified rather worthless. |
Hey @felixfontein, Thanks for your explanations!
I am aware that Docker ignores the tag when the digest is specified. For me, it's simply a matter of ease when handling dependency updates. Digests don't give a clue about which version they reference, and it's easy to mismatch them. I have also discovered another behavior, I suspect is a bug. Adding - name: "Create Nginx container"
docker_container:
comparisons:
"*": "strict"
image: "nginx:1.25.3@sha256:d02f9b9db4d759ef27dc26b426b842ff2fb881c5c6079612d27ec36e36b132dd"
name: "nginx"
state: "started" See the task recap: TASK [Create Nginx container] ******************************************************************************************
--- before
+++ after
@@ -1,12 +1,5 @@
{
- "env": [
- "NGINX_VERSION=1.25.3",
- "NJS_VERSION=0.8.2",
- "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
- "PKG_RELEASE=1~bookworm"
- ],
- "exposed_ports": [
- "80/tcp"
- ],
+ "env": [],
+ "exposed_ports": [],
"running": true
}
changed: [locahost] I would have expected the container not to be re-created every run, the same as when you specify either the |
SUMMARY
Executing the module
docker_container
in check mode always reports a change when referencing atag
anddigest
for an image at the same time, e.gThe same module executed in
normal
mode doesn't report a change.ISSUE TYPE
COMPONENT NAME
module:
docker_container
ANSIBLE VERSION
COLLECTION VERSION
OS / ENVIRONMENT
Linux Debian 4.19.289-2
STEPS TO REPRODUCE
--check
option;EXPECTED RESULTS
The task should not report a change as the container configuration didn't change.
ACTUAL RESULTS
The recap displays the task as changed:
TASK [Create Nginx container] **************************************************************************************** changed: [localhost]
With
--diff
option, the task doesn't report any hint on the diff:The text was updated successfully, but these errors were encountered: