Question on force_source in community.docker.docker_image

Hi,

I have a question on how the force_source works in community.docker.docker_image in case of pulling docker image.

Assuming that I already have a my-awesome-stuff/my-image:my-tag locally and run ansible playbook with task


- name: "Pull docker image"
community.docker.docker_image:
name: "my-awesome-stuff/my-image:my-tag"
state: present
source: pull
force_source: yes

which of the following will happen:

a) - ansible sees that image is present but calls docker pull logic anyway

  • docker pull realises that image is the same so no download happens

b) ansible notices foruce_source flag so download happens even if not required

The context I am interested in is if in the hub there is some tag that is rolling, -dev for example, and I want to insure that if the image will be updated in the hub then new version would be pulled but at the same time avoid unnecessary pulls.

Bonus question: how does the behaviour changes if the tag is latest?

Hi,

I have a question on how the `force_source` works in
`community.docker.docker_image` in case of pulling docker image.

Assuming that I already have a `my-awesome-stuff/my-image:my-tag`
locally and run ansible playbook with task

- name: "Pull docker image"
  community.docker.docker_image:
    name: "my-awesome-stuff/my-image:my-tag"
    state: present
    source: pull
    force_source: yes

which of the following will happen:

a) - ansible sees that image is present but calls `docker pull` logic
anyway
    - docker pull realises that image is the same so no download
happens

b) ansible notices `foruce_source` flag so download happens even if
not required

a) will happen. Then Ansible will process the `docker pull` log and
notice that nothing was pulled, and will return changed=False.

Bonus question: how does the behaviour changes if the tag is
`latest`?

The behavior does not depend on the tag's name.

Cheers,
Felix

Thank you Felix, exactly what I needed!