Podman: `podman inspect -t container --size myctr` not working

Created on 23 Dec 2019  路  6Comments  路  Source: containers/podman

/kind bug

Description

The --size option in a command like:

podman inspect -t container --size myctr

is being ignored. Instead of just the size being returned, the whole inspect output is instead shown.

Steps to reproduce the issue:

  1. podman pull alpine

  2. podman run --name=myctr alpine ls /etc/network

  3. podman inspect --size -t container myctr

Describe the results you received:

Full inspect output of the container showing all fields and values.

Describe the results you expected:

Just the size of the container per the man page.

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

Output of podman version:

# podman version
Version:            1.6.2
RemoteAPI Version:  1
Go Version:         go1.13.1
OS/Arch:            linux/amd64

Output of podman info --debug:

# podman version
Version:            1.6.2
RemoteAPI Version:  1
Go Version:         go1.13.1
OS/Arch:            linux/amd64
[root@localhost ~]# podman info --debug
debug:
  compiler: gc
  git commit: ""
  go version: go1.13.1
  podman version: 1.6.2
host:
  BuildahVersion: 1.11.3
  CgroupVersion: v2
  Conmon:
    package: conmon-2.0.2-1.fc31.x86_64
    path: /usr/bin/conmon
    version: 'conmon version 2.0.2, commit: 186a550ba0866ce799d74006dab97969a2107979'
  Distribution:
    distribution: fedora
    version: "31"
  MemFree: 1194172416
  MemTotal: 2083917824
  OCIRuntime:
    name: crun
    package: crun-0.10.6-1.fc31.x86_64
    path: /usr/bin/crun
    version: |-
      crun version 0.10.6
      spec: 1.0.0
      +SYSTEMD +SELINUX +APPARMOR +CAP +SECCOMP +EBPF +YAJL
  SwapFree: 2147479552
  SwapTotal: 2147479552
  arch: amd64
  cpus: 1
  eventlogger: journald
  hostname: localhost.localdomain
  kernel: 5.3.16-300.fc31.x86_64
  os: linux
  rootless: false
  uptime: 4h 19m 2.13s (Approximately 0.17 days)
registries:
  blocked: null
  insecure: null
  search:
  - docker.io
  - registry.fedoraproject.org
  - registry.access.redhat.com
  - registry.centos.org
  - quay.io
store:
  ConfigFile: /etc/containers/storage.conf
  ContainerStore:
    number: 1
  GraphDriverName: overlay
  GraphOptions:
    overlay.mountopt: nodev,metacopy=on
  GraphRoot: /var/lib/containers/storage
  GraphStatus:
    Backing Filesystem: xfs
    Native Overlay Diff: "false"
    Supports d_type: "true"
    Using metacopy: "true"
  ImageStore:
    number: 1
  RunRoot: /var/run/containers/storage
  VolumePath: /var/lib/containers/storage/volumes

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

# rpm -q podman
podman-1.6.2-2.fc31.x86_64

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

Good First Issue kinbug

All 6 comments

I think we expect --size to show everything plus size - if size is being shown, it should be working right. I think you need a --format to get just the size.

If size is being shown, I'm losing it in all of the output and I'm not gronking it with grep:

 podman inspect --size -t container myctr | grep ize
        "SizeRootFs": 5591300,
            "ShmSize": 65536000,
            "ConsoleSize": [

Hm. I'll take a look

If this issue is still available, I am happy to take it too.

But when reading the comments and the issue description, I get confused:
do we want to display all the fields + the size or only the size?

@NevilleC the man page says:

鈥搒ize, -s

Display the total file size if the type is a container

So in my book, we should only display the size of the container. I'll let @mheon correct that if necessary, and then we may need to also adjust the man page too. @NevilleC I've assigned the issue to you, thanks for hopping on to it!

Per Docker, we should display the full output of inspect per usual, but actually populate the SizeRw and SizeRootFs fields (which are otherwise always 0)

Was this page helpful?
0 / 5 - 0 ratings