-
Notifications
You must be signed in to change notification settings - Fork 122
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
pull as true + check mode + existing local image means no changes for the module #792
Comments
Docker does not support this, so it's impossible to implement. |
But how a |
The Docker daemon does know this, but it does not provide any endpoint to clients that allow them to ask for this information. Since the docker_container module is not part of the Docker daemon, it has no way to get hold of that information until it starts an actual pull (which it must not do in check mode to avoid changing data). |
I see. That is a big lack. And generates a dangerous behavior. Thanks for your fast answer. I let you close if you want |
I fully agree. I'll definitely update the docs so this is explicitly mentioned. |
Hmm, I just checked, there's already a comment for the check mode attribute: I'm wondering whether we should make this behavior configurable, since I can see good arguments for both behaviors. On the other hand, this is quite a special case and making the module interface even more complex for it feels like not a good idea. |
Yes that would be better to at least be able to configure the behavior. |
I've implemented this in #797. |
SUMMARY
When this module is used with
pull
parameter as true, check mode and with an existing local image, the module always considers there is no changes. You will have the surprise during the real execution that your container has been recreated with a new image.The source code is pretty straightforward :
community.docker/plugins/module_utils/module_container/module.py
Lines 447 to 461 in 7b55408
ISSUE TYPE
COMPONENT NAME
docker_container module
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
STEPS TO REPRODUCE
With these kind of playbook configuration
EXPECTED RESULTS
With pull as true, the module should check with the remote registry if the local image is up-to-date or not
ACTUAL RESULTS
If a local image exists, the module say no changes on check mode.
The text was updated successfully, but these errors were encountered: