- 
                Notifications
    
You must be signed in to change notification settings  - Fork 2.8k
 
Description
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.