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

REST API: /v1.24/images/${img}/history contains "Size":0 where docker has "Size":7458929 #20375

Closed
eriksjolund opened this issue Oct 16, 2023 · 2 comments · Fixed by containers/common#1697 or #20381
Assignees
Labels
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

@eriksjolund
Copy link
Contributor

eriksjolund commented Oct 16, 2023

Issue Description

REST API: Result from /v1.24/images/${img}/history contains "Size":0 where docker has "Size":7458929

Steps to reproduce the issue

On Fedora CoreOS 39.20231006.1.0 (aarch64) VM perform the following steps:

  1. sudo -i
  2. systemctl start docker
  3. useradd test
  4. usermod -aG docker
  5. machinectl shell --uid test
  6. img=$(podman pull alpine:3.17.2)
  7. docker pull alpine:3.17.2
  8. systemctl --user start podman.socket
  9. curl -s --unix-socket /var/run/docker.sock http://localhost/v1.24/images/${img}/history > docker-result.txt
  10. curl -s --unix-socket $XDG_RUNTIME_DIR/podman/podman.sock http://localhost/v1.24/images/${img}/history > podman-result.txt
  11. cat result-docker.txt | jq '.[1].Size'
  12. cat result-podman.txt | jq '.[1].Size'

Describe the results you received

Step 11:

$ cat result-docker.txt | jq '.[1].Size'
7458929

Step 12:

$ cat result-podman.txt | jq '.[1].Size'
0

Describe the results you expected

I expected to see the same number in both Step 11 and Step 12

podman info output

host:
  arch: arm64
  buildahVersion: 1.32.0
  cgroupControllers:
  - cpu
  - memory
  - pids
  cgroupManager: systemd
  cgroupVersion: v2
  conmon:
    package: conmon-2.1.7-3.fc39.aarch64
    path: /usr/bin/conmon
    version: 'conmon version 2.1.7, commit: '
  cpuUtilization:
    idlePercent: 97.6
    systemPercent: 1.37
    userPercent: 1.03
  cpus: 1
  databaseBackend: boltdb
  distribution:
    distribution: fedora
    variant: coreos
    version: "39"
  eventLogger: journald
  freeLocks: 2048
  hostname: localhost.localdomain
  idMappings:
    gidmap:
    - container_id: 0
      host_id: 1011
      size: 1
    - container_id: 1
      host_id: 1245184
      size: 65536
    uidmap:
    - container_id: 0
      host_id: 1011
      size: 1
    - container_id: 1
      host_id: 1245184
      size: 65536
  kernel: 6.5.5-300.fc39.aarch64
  linkmode: dynamic
  logDriver: journald
  memFree: 1244913664
  memTotal: 1980260352
  networkBackend: netavark
  networkBackendInfo:
    backend: netavark
    dns:
      package: aardvark-dns-1.7.0-2.fc39.aarch64
      path: /usr/libexec/podman/aardvark-dns
      version: aardvark-dns 1.7.0
    package: netavark-1.7.0-2.fc39.aarch64
    path: /usr/libexec/podman/netavark
    version: netavark 1.7.0
  ociRuntime:
    name: crun
    package: crun-1.9.2-1.fc39.aarch64
    path: /usr/bin/crun
    version: |-
      crun version 1.9.2
      commit: 35274d346d2e9ffeacb22cc11590b0266a23d634
      rundir: /run/user/1011/crun
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +CRIU +LIBKRUN +WASM:wasmedge +YAJL
  os: linux
  pasta:
    executable: /usr/bin/pasta
    package: passt-0^20230908.g05627dc-1.fc39.aarch64
    version: |
      pasta 0^20230908.g05627dc-1.fc39.aarch64-pasta
      Copyright Red Hat
      GNU General Public License, version 2 or later
        <https://www.gnu.org/licenses/old-licenses/gpl-2.0.html>
      This is free software: you are free to change and redistribute it.
      There is NO WARRANTY, to the extent permitted by law.
  remoteSocket:
    exists: true
    path: /run/user/1011/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: /usr/share/containers/seccomp.json
    selinuxEnabled: true
  serviceIsRemote: false
  slirp4netns:
    executable: /usr/bin/slirp4netns
    package: slirp4netns-1.2.1-1.fc39.aarch64
    version: |-
      slirp4netns version 1.2.1
      commit: 09e31e92fa3d2a1d3ca261adaeb012c8d75a8194
      libslirp: 4.7.0
      SLIRP_CONFIG_VERSION_MAX: 4
      libseccomp: 2.5.3
  swapFree: 0
  swapTotal: 0
  uptime: 0h 27m 34.00s
plugins:
  authorization: null
  log:
  - k8s-file
  - none
  - passthrough
  - journald
  network:
  - bridge
  - macvlan
  - ipvlan
  volume:
  - local
registries:
  search:
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - docker.io
  - quay.io
store:
  configFile: /var/home/test11/.config/containers/storage.conf
  containerStore:
    number: 0
    paused: 0
    running: 0
    stopped: 0
  graphDriverName: overlay
  graphOptions: {}
  graphRoot: /var/home/test11/.local/share/containers/storage
  graphRootAllocated: 24091013120
  graphRootUsed: 7668953088
  graphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "true"
    Supports d_type: "true"
    Supports shifting: "false"
    Supports volatile: "true"
    Using metacopy: "false"
  imageCopyTmpDir: /var/tmp
  imageStore:
    number: 1
  runRoot: /run/user/1011/containers
  transientStore: false
  volumePath: /var/home/test11/.local/share/containers/storage/volumes
version:
  APIVersion: 4.7.0
  Built: 1695838660
  BuiltTime: Wed Sep 27 18:17:40 2023
  GitCommit: ""
  GoVersion: go1.21.1
  Os: linux
  OsArch: linux/arm64
  Version: 4.7.0

Podman in a container

No

Privileged Or Rootless

Rootless

Upstream Latest Release

Yes

Additional environment details

$ rpm -q podman
podman-4.7.0-1.fc39.aarch64
$ rpm -q moby-engine
moby-engine-24.0.5-1.fc39.aarch64
$ 

Additional information

The whole result from the REST API calls above.

$ cat result-docker.txt | jq .
[
  {
    "Comment": "",
    "Created": 1676064248,
    "CreatedBy": "/bin/sh -c #(nop)  CMD [\"/bin/sh\"]",
    "Id": "sha256:d74e625d91152966d38fe8a62c60daadb96d4b94c1a366de01fab5f334806239",
    "Size": 0,
    "Tags": [
      "alpine:3.17.2"
    ]
  },
  {
    "Comment": "",
    "Created": 1676064248,
    "CreatedBy": "/bin/sh -c #(nop) ADD file:9bd9ea42a9f3bdc769e80c6b8a4b117d65f73ae68e155a6172a1184e7ac8bcc1 in / ",
    "Id": "<missing>",
    "Size": 7458929,
    "Tags": null
  }
]
$ cat result-podman.txt | jq .
[
  {
    "Id": "sha256:d74e625d91152966d38fe8a62c60daadb96d4b94c1a366de01fab5f334806239",
    "Created": 1676064248,
    "CreatedBy": "/bin/sh -c #(nop)  CMD [\"/bin/sh\"]",
    "Tags": [
      "docker.io/library/alpine:3.17.2"
    ],
    "Size": 0,
    "Comment": ""
  },
  {
    "Id": "sha256:<missing>",
    "Created": 1676064248,
    "CreatedBy": "/bin/sh -c #(nop) ADD file:9bd9ea42a9f3bdc769e80c6b8a4b117d65f73ae68e155a6172a1184e7ac8bcc1 in / ",
    "Tags": null,
    "Size": 0,
    "Comment": ""
  }
]
@vrothberg
Copy link
Member

Can reproduce on the CLI as well:

podman (main) $ ./bin/podman image history alpine
ID            CREATED      CREATED BY                                     SIZE        COMMENT
8ca4688f4f35  2 weeks ago  /bin/sh -c #(nop)  CMD ["/bin/sh"]             0B          
<missing>     2 weeks ago  /bin/sh -c #(nop) ADD file:756183bba9c7f45...  0B          

vrothberg added a commit to vrothberg/common that referenced this issue Oct 17, 2023
Computing the history did not walk the layers correctly.  Fix that and
try to improve the code to make it easier to read and maintain for
future pairs of eyes.

A regression will be added to the Podman PR vendoring this change.

Fixes: containers/podman/issues/20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
vrothberg added a commit to vrothberg/common that referenced this issue Oct 17, 2023
Computing the history did not walk the layers correctly.  Fix that and
try to improve the code to make it easier to read and maintain for
future pairs of eyes.

A regression will be added to the Podman PR vendoring this change.

Fixes: containers/podman/issues/20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
vrothberg added a commit to vrothberg/libpod that referenced this issue Oct 17, 2023
libimage did not walk thte layers correctly which was probably
inherited by old Podman code.  Fix that by vendoring in the
corresponding changes in c/common.

Fixes: containers#20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
@vrothberg
Copy link
Member

Opened #20381 to fix the issue.

vrothberg added a commit to vrothberg/common that referenced this issue Oct 17, 2023
Computing the history did not walk the layers correctly.  Fix that and
try to improve the code to make it easier to read and maintain for
future pairs of eyes.

A regression will also be added to the Podman PR vendoring this change.

Fixes: containers/podman/issues/20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
vrothberg added a commit to vrothberg/common that referenced this issue Oct 17, 2023
Computing the history did not walk the layers correctly.  Fix that and
try to improve the code to make it easier to read and maintain for
future pairs of eyes.

A regression will also be added to the Podman PR vendoring this change.

Fixes: containers/podman/issues/20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
vrothberg added a commit to vrothberg/libpod that referenced this issue Oct 17, 2023
libimage did not walk thte layers correctly which was probably
inherited by old Podman code.  Fix that by vendoring in the
corresponding changes in c/common.

Fixes: containers#20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
vrothberg added a commit to vrothberg/common that referenced this issue Oct 17, 2023
Computing the history did not walk the layers correctly.  Fix that and
try to improve the code to make it easier to read and maintain for
future pairs of eyes.

A regression will also be added to the Podman PR vendoring this change.

Fixes: containers/podman/issues/20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
vrothberg added a commit to vrothberg/libpod that referenced this issue Oct 17, 2023
libimage did not walk thte layers correctly which was probably
inherited by old Podman code.  Fix that by vendoring in the
corresponding changes in c/common.

Fixes: containers#20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
vrothberg added a commit to vrothberg/libpod that referenced this issue Oct 18, 2023
libimage did not walk thte layers correctly which was probably
inherited by old Podman code.  Fix that by vendoring in the
corresponding changes in c/common.

Fixes: containers#20375
Signed-off-by: Valentin Rothberg <vrothberg@redhat.com>
@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 Jan 16, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
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
2 participants