Currently the docker module only restarts the container if the name parameter is specified and the image has changed. Are there plans to also check if other docker parameters have changed such as env, port and volume?
It is pretty common to pass in configuration information via environment variables to containers. It would be nice if the Ansible docker modules realizes docker parameters have changed, then automatically restart the container.
I don’t think volume or port will change often but configuration information via environment variables will certainly evolve over time.
I know in the previous post I also talked about also checking other parameters such as volume and port.
Maybe that can be done as a separate PR. I believe just the environmental detection is useful on its own.
The issue I'm trying to tackle is slightly different than yours. My
image:tag has not changed (ie, not using latest but actual version
tag) but some other Docker parameters have changed within Ansible
playbook. The code patch above only currently handles environment
variables, but I plan to also handle port and volumes sometime today.
The issue you reference is also what I have been seeing, but it is not
an issue for me because the tag and image are being changed at the
same time.