Skip to content
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

Podman prints wrong image name in inspection when image has two tags #8082

Closed
sshnaidm opened this issue Oct 20, 2020 · 3 comments · Fixed by #8098
Closed

Podman prints wrong image name in inspection when image has two tags #8082

sshnaidm opened this issue Oct 20, 2020 · 3 comments · Fixed by #8098
Assignees
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@sshnaidm
Copy link
Member

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

When an image has two different tags that points to the same layer, Podman prints wrong image information in container inspection.

Steps to reproduce the issue:

podman run -dit --name bugtest docker.io/library/httpd:2
podman inspect bugtest | grep -i image
        "Image": "3dd970e6b110c8cbcec63e05a91e3cefd23c76a780fcb78c33979153f044b2d4",
        "ImageName": "docker.io/library/httpd:2",
            "Image": "docker.io/library/httpd:2",

podman rm -f bugtest
podman pull docker.io/library/httpd:latest
podman run -dit --name bugtest docker.io/library/httpd:2
podman inspect bugtest | grep -i image
        "Image": "3dd970e6b110c8cbcec63e05a91e3cefd23c76a780fcb78c33979153f044b2d4",
        "ImageName": "docker.io/library/httpd:latest",
            "Image": "docker.io/library/httpd:latest",
                "org.opencontainers.image.stopSignal": "28"

Images have the same Id:

$ podman image inspect httpd:2 | grep Id
        "Id": "3dd970e6b110c8cbcec63e05a91e3cefd23c76a780fcb78c33979153f044b2d4",
$ podman image inspect httpd:latest | grep Id
        "Id": "3dd970e6b110c8cbcec63e05a91e3cefd23c76a780fcb78c33979153f044b2d4",

Describe the results you received:

Wrong Image name in inspection.

Describe the results you expected:
When running podman run -dit --name bugtest docker.io/library/httpd:2 and then podman inspect bugtest I'd like to get "Image": "docker.io/library/httpd:2" and not "Image": "docker.io/library/httpd:latest", even if this is the same image actually.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Version:      2.1.1
API Version:  2.0.0
Go Version:   go1.13.15
Built:        Wed Sep 30 22:51:15 2020
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.16.1
  cgroupManager: cgroupfs
  cgroupVersion: v1
  conmon:
    package: conmon-2.0.21-2.fc31.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.21, commit: d9f047cb413248e30a1ec560547d9b203396c31b'
  cpus: 4
  distribution:
    distribution: fedora
    version: "31"
  eventLogger: journald
  hostname: sshnaidm.remote
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    - container_id: 1
      host_id: 100000
      size: 65536
  kernel: 5.8.13-100.fc31.x86_64
  linkmode: dynamic
  memFree: 1975996416
  memTotal: 25083412480
  ociRuntime:
    name: runc
    package: runc-1.0.0-102.dev.gitdc9208a.fc31.x86_64
    path: /usr/bin/runc
    version: |-
      runc version 1.0.0-rc10
      commit: 96f6022b37cbe12b26c9ad33a24677bec72a9cc3
      spec: 1.0.1-dev
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  rootless: true
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.1.4-1.fc31.x86_64
    version: |-
      slirp4netns version 1.1.4
      commit: b66ffa8e262507e37fca689822d23430f3357fe8
      libslirp: 4.1.0
      SLIRP_CONFIG_VERSION_MAX: 1
  swapFree: 12377387008
  swapTotal: 12645822464
  uptime: 125h 37m 56.61s (Approximately 5.21 days)
registries:
  search:
  - docker.io
  - registry.fedoraproject.org
  - quay.io
  - registry.access.redhat.com
  - registry.centos.org
store:
  configFile: /home/sshnaidm/.config/containers/storage.conf
  containerStore:
    number: 1
    paused: 0
    running: 1
    stopped: 0
  graphDriverName: overlay
  graphOptions:
    overlay.mount_program:
      Executable: /usr/bin/fuse-overlayfs
      Package: fuse-overlayfs-1.1.2-1.fc31.x86_64
      Version: |-
        fusermount3 version: 3.6.2
        fuse-overlayfs: version 1.1.0
        FUSE library version 3.6.2
        using FUSE kernel interface version 7.29
  graphRoot: /home/sshnaidm/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 202
  runRoot: /tmp/1000
  volumePath: /home/sshnaidm/.local/share/containers/storage/volumes
version:
  APIVersion: 2.0.0
  Built: 1601495475
  BuiltTime: Wed Sep 30 22:51:15 2020
  GitCommit: ""
  GoVersion: go1.13.15
  OsArch: linux/amd64
  Version: 2.1.1

Package info (e.g. output of rpm -q podman or apt list podman):

podman-2.1.1-3.fc31.x86_64

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

Discovered from issue in Ansible Podman modules: containers/ansible-podman-collections#125
It breaks idempotency of podman_container module because we compare Image in input parameters and info from container inspection, and it's different.

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 20, 2020
@mheon
Copy link
Member

mheon commented Oct 20, 2020

@vrothberg PTAL

@rhatdan
Copy link
Member

rhatdan commented Oct 20, 2020

If a image has multiple tags, we should probably never use the :latest flag.

@vrothberg
Copy link
Member

We store the raw-image name (i.e., the user input) for each container. We should use that for looking up the "right" image during inspection.

@vrothberg vrothberg self-assigned this Oct 21, 2020
@vrothberg vrothberg added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Oct 21, 2020
vrothberg added a commit to vrothberg/libpod that referenced this issue Oct 21, 2020
Record the correct image name when creating a container by using the
resolved image name if present.  Otherwise, default to using the first
available name or an empty string in which case the image must have been
referenced by ID.

Fixes: containers#8082
Signed-off-by: Valentin Rothberg <[email protected]>
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
In Progress This issue is actively being worked by the assignee, please do not work on this at this time. kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants