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

Docker API image queries returning differing Id values #11623

Closed
Etzos opened this issue Sep 17, 2021 · 2 comments · Fixed by #11656
Closed

Docker API image queries returning differing Id values #11623

Etzos opened this issue Sep 17, 2021 · 2 comments · Fixed by #11656
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

@Etzos
Copy link

Etzos commented Sep 17, 2021

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

/kind bug

Description

The Docker-compatible Unix sock api seems too provide differing values for the Id field between /images/json and /images/<imageName>/json. The latter includes the "sha256:" prefix while the latter does not. Docker itself seems to use the prefix in both cases. Apologies if I'm using incorrect terms or I'm obviously wrong about this one, it just seemed a bit unusual to me.

Steps to reproduce the issue:

  1. Pull any image (quay.io/bitnami/nginx in my case)

  2. Run curl -s --unix-socket /run/podman/podman.sock http://v1.24/images/json and observe the Id value

  3. Run curl -s --unix-socket /run/podman/podman.sock http://v1.24/images/someimagename/json and observe its Id value

Describe the results you received:
For /images/json:

[
  {
    "Id": "4f083bc972644c9476d1b5e6146b6908624324c396382af72f9a7472a35d2bb1",
    "ParentId": "",
    "RepoTags": [
      "quay.io/bitnami/nginx:latest"
    ],
    "RepoDigests": [
      "quay.io/bitnami/nginx@sha256:bb6e530de68602524081684dc5d44babdb3415cd2473f0621963d63e174850fe"
    ],
    "Created": 1631837091,
    "Size": 93296482,
    "SharedSize": 0,
    "VirtualSize": 93296482,
    "Labels": {
      "maintainer": "Bitnami <[email protected]>"
    },
    "Containers": 0,
    "Names": [
      "quay.io/bitnami/nginx:latest"
    ],
    "Digest": "sha256:bb6e530de68602524081684dc5d44babdb3415cd2473f0621963d63e174850fe",
    "History": [
      "quay.io/bitnami/nginx:latest"
    ]
  }
]

For /images/someimagename/json:

{
  "Id": "sha256:4f083bc972644c9476d1b5e6146b6908624324c396382af72f9a7472a35d2bb1",
  "RepoTags": [
    "quay.io/bitnami/nginx:latest"
  ],
  "RepoDigests": [
    "quay.io/bitnami/nginx@sha256:bb6e530de68602524081684dc5d44babdb3415cd2473f0621963d63e174850fe"
  ],
  "Parent": "",
  "Comment": "",
  "Created": "2021-09-17T00:04:51.372250317Z",
  "Container": "",
  // Truncated for convenience 
}

Describe the results you expected:
I expected that both of the Id values would have the sha256: prefix, or would at least match.

The output from Docker is:
For /images/json

[
  {
    "Containers": -1,
    "Created": 1631925086,
    "Id": "sha256:3e7a2b4f9ae55fd97cf043103b6ad813f56b67b04e610899567b52fb9007c66f",
    "Labels": {
      "maintainer": "Bitnami <[email protected]>"
    },
    "ParentId": "",
    "RepoDigests": [
      "quay.io/bitnami/nginx@sha256:a181de8a050b6145c20bc270335b5216f9ec294dc5b7dd87eb9728fde90732c6"
    ],
    "RepoTags": [
      "quay.io/bitnami/nginx:latest"
    ],
    "SharedSize": -1,
    "Size": 89139605,
    "VirtualSize": 89139605
  }
]

For /images/someimagename/json

{
  "Id": "sha256:3e7a2b4f9ae55fd97cf043103b6ad813f56b67b04e610899567b52fb9007c66f",
  "RepoTags": [
    "quay.io/bitnami/nginx:latest"
  ],
  "RepoDigests": [
    "quay.io/bitnami/nginx@sha256:a181de8a050b6145c20bc270335b5216f9ec294dc5b7dd87eb9728fde90732c6"
  ],
  "Parent": "",
  "Comment": "",
  "Created": "2021-09-18T00:31:26.978762695Z",
  "Container": "6007a31fe403afe5f18a0b636a764ff09a03c16191f5c538d47f194f5ed682bf",
  "ContainerConfig": {
    "Hostname": "6007a31fe403",
    "Domainname": "",
    "User": "1001",
    "AttachStdin": false,
    "AttachStdout": false,
    "AttachStderr": false,
    "ExposedPorts": {
      "8080/tcp": {},
      "8443/tcp": {}
    },
   // Further details omitted for brevity
}

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

Output of podman version:

Server:
Version:      3.3.1
API Version:  3.3.1
Go Version:   go1.17
Git Commit:   4c5283fabff2de5145838f1847a5a7b2b1fbc0a5-dirty
Built:        Wed Sep  1 13:27:46 2021
OS/Arch:      linux/amd64

Output of podman info --debug:

host:
  arch: amd64
  buildahVersion: 1.22.3
  cgroupControllers: []
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: /usr/bin/conmon is owned by conmon 1:2.0.29-1
    path: /usr/bin/conmon
    version: 'conmon version 2.0.29, commit: 7e6de6678f6ed8a18661e1d5721b81ccee293b9b'
  cpus: 8
  distribution:
    distribution: arch
    version: unknown
  eventLogger: journald
  hostname: USS-Arkon
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1000
      size: 1
    uidmap:
    - container_id: 0
      host_id: 1000
      size: 1
  kernel: 5.14.5-arch1-1
  linkmode: dynamic
  memFree: 10778304512
  memTotal: 16552943616
  ociRuntime:
    name: crun
    package: /usr/bin/crun is owned by crun 1.0-1
    path: /usr/bin/crun
    version: |-
      crun version 1.0
      commit: 139dc6971e2f1d931af520188763e984d6cdfbf8
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  os: linux
  remoteSocket:
    path: /run/user/1000/podman/podman.sock
  security:
    apparmorEnabled: false
    capabilities: CAP_CHOWN,CAP_DAC_OVERRIDE,CAP_FOWNER,CAP_FSETID,CAP_KILL,CAP_NET_BIND_SERVICE,CAP_SETFCAP,CAP_SETGID,CAP_SETPCAP,CAP_SETUID,CAP_SYS_CHROOT
    rootless: true
    seccompEnabled: true
    seccompProfilePath: /etc/containers/seccomp.json
    selinuxEnabled: false
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: /usr/bin/slirp4netns is owned by slirp4netns 1.1.12-1
    version: |-
      slirp4netns version 1.1.12
      commit: 7a104a101aa3278a2152351a082a6df71f57c9a3
      libslirp: 4.6.1
      SLIRP_CONFIG_VERSION_MAX: 3
      libseccomp: 2.5.2
  swapFree: 4294963200
  swapTotal: 4294963200
  uptime: 25m 31.57s
registries: {}
store:
  configFile: /home/kevin/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /home/kevin/.local/share/containers/storage
  graphStatus:
    Backing Filesystem: extfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Using metacopy: "false"
  imageStore:
    number: 0
  runRoot: /run/user/1000/containers
  volumePath: /home/kevin/.local/share/containers/storage/volumes
version:
  APIVersion: 3.3.1
  Built: 1630517266
  BuiltTime: Wed Sep  1 13:27:46 2021
  GitCommit: 4c5283fabff2de5145838f1847a5a7b2b1fbc0a5-dirty
  GoVersion: go1.17
  OsArch: linux/amd64
  Version: 3.3.1

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

community/podman 3.3.1-1 [installed]

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes

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

I tested this both on a Mac as well as a linux laptop running Arch.

@openshift-ci openshift-ci bot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 17, 2021
@rhatdan
Copy link
Member

rhatdan commented Sep 17, 2021

Which is the correct value to return? IE What does Docker do?
@jwhonce PTAL

@Etzos
Copy link
Author

Etzos commented Sep 18, 2021

I've updated the description to show what Docker returns for the same nginx package on the same machine.

@Luap99 Luap99 self-assigned this Sep 20, 2021
@Luap99 Luap99 added the In Progress This issue is actively being worked by the assignee, please do not work on this at this time. label Sep 20, 2021
Luap99 added a commit to Luap99/libpod that referenced this issue Sep 20, 2021
Docker adds the `sha256:` prefix to the image ID, so our compat endpoint
has to do this as well.

Fixes containers#11623

Signed-off-by: Paul Holzinger <[email protected]>
mheon pushed a commit to mheon/libpod that referenced this issue Sep 22, 2021
Docker adds the `sha256:` prefix to the image ID, so our compat endpoint
has to do this as well.

Fixes containers#11623

Signed-off-by: Paul Holzinger <[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 21, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 21, 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.

3 participants