Skip to content

Perma diff in check mode when referencing image tag + digest #790

Open
@PierreBart

Description

@PierreBart
SUMMARY

Executing the module docker_container in check mode always reports a change when referencing a tag and digest for an image at the same time, e.g

- docker_container:
    image: "nginx:1.25.3@sha256:d02f9b9db4d759ef27dc26b426b842ff2fb881c5c6079612d27ec36e36b132dd"

The same module executed in normal mode doesn't report a change.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

module: docker_container

ANSIBLE VERSION
ansible [core 2.16.2]
  python version = 3.11.3 (main, May 15 2023, 14:35:06) [Clang 14.0.3 (clang-1403.0.22.14.1)]
  jinja version = 3.1.2
  libyaml = True
COLLECTION VERSION
/Users/user/Library/Caches/pypoetry/virtualenvs/infra-vKVwe6_N-py3.11/lib/python3.11/site-packages/ansible_collections
Collection        Version
----------------- -------
community.general 8.1.0
OS / ENVIRONMENT

Linux Debian 4.19.289-2

STEPS TO REPRODUCE
  1. Run the following task once to create the container on the host
    - name: "Create Nginx container"
      docker_container:
        image: "nginx:1.25.3@sha256:d02f9b9db4d759ef27dc26b426b842ff2fb881c5c6079612d27ec36e36b132dd"
        name: "nginx"
        state: "started"
  1. Re-run the previous task with --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:

    "diff": {
        "after": {},
        "before": {}
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingdocker-plainplain Docker (no swarm, no compose, no stack)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions