Skip to content

c8d: image inspect should not contain duplicate RepoDigests #48747

@thaJeztah

Description

@thaJeztah

Description

Taking the following example;

echo -e 'FROM alpine:latest\nLABEL foo=bar' | docker build \
    --tag localhost:5000/namespace1/myimage:latest \
    --tag localhost:5000/namespace1/myimage:1.0.0 \
    --tag localhost:5000/namespace2/myimage:latest \
    --tag localhost:5000/namespace2/myimage:1.0.0 \
    -

Without containerd store

We need to push the images to have their digest produced (this is not needed with the containerd image store enabled)

docker push --all-tags localhost:5000/namespace1/myimage
docker push --all-tags localhost:5000/namespace2/myimage

After this, inspecting shows that there's no duplicates in the RepoDigests;

docker image inspect --format '{{json .RepoDigests}}' localhost:5000/namespace1/myimage:latest | jq
[
  "localhost:5000/namespace1/myimage@sha256:098a58165c88f57b276cf9bcb81087c3fc3be14f27320b83f0988829d4e856fc",
  "localhost:5000/namespace2/myimage@sha256:098a58165c88f57b276cf9bcb81087c3fc3be14f27320b83f0988829d4e856fc"
]

With containerd store

With the containerd image store enabled, each tag of the image also produces an entry in the digests;

docker image inspect --format '{{json .RepoDigests}}' localhost:5000/namespace1/myimage:latest | jq
[
  "localhost:5000/namespace1/myimage@sha256:3b3bdb5db88500448c1588a124645d9d1c0a95c7476351e76b80a663582996fd",
  "localhost:5000/namespace1/myimage@sha256:3b3bdb5db88500448c1588a124645d9d1c0a95c7476351e76b80a663582996fd",
  "localhost:5000/namespace2/myimage@sha256:3b3bdb5db88500448c1588a124645d9d1c0a95c7476351e76b80a663582996fd",
  "localhost:5000/namespace2/myimage@sha256:3b3bdb5db88500448c1588a124645d9d1c0a95c7476351e76b80a663582996fd"
]

Reproduce

see above

Expected behavior

The list of RepoDigests should be unique. We should remove duplicates from the list.

docker version

Client:
 Version:           27.3.1
 API version:       1.47
 Go version:        go1.22.7
 Git commit:        ce12230
 Built:             Fri Sep 20 11:38:18 2024
 OS/Arch:           darwin/arm64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          27.3.1
  API version:      1.47 (minimum version 1.24)
  Go version:       go1.22.7
  Git commit:       41ca978
  Built:            Fri Sep 20 11:39:57 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          v1.7.22
  GitCommit:        7f7fdf5fed64eb6a7caf99b3e12efcf9d60e311c
 runc:
  Version:          1.1.14
  GitCommit:        v1.1.14-0-g2c9f560
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

docker info

not relevant

Additional Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/apiAPIarea/imagesImage Servicecontainerd-integrationIssues and PRs related to containerd integrationkind/bugBugs are bugs. The cause may or may not be known at triage time so debugging may be needed.version/27.3

    Type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions