podman-container-inspect(1)

<h1>πŸ’œ podman-container-inspect(1) β€” the general commands manual, but make it a vibe πŸ’œ</h1>

okay so you opened up podman-container-inspect(1) and honestly? good choice bestie. this is the page that tells you how to peer directly into a container's soul and see all its lowkey innermost config. no cap, it's giving x-ray vision for containers 🩻✨


🌸 NAME 🌸

podman-container-inspect β€” display a container's configuration πŸ‘€πŸ’…

✨ SYNOPSIS ✨

podman container inspect [options] container [container ...]

πŸŽ€ DESCRIPTION πŸŽ€

okay so picture this: you wanna see the low-level information on some containers, right? you can point at them by name or by ID β€” either one works, she's flexible like that 🫢

by default, this thing renders all your results in a JSON array. very demure, very structured, very "here's everything at once" πŸ“¦βœ¨

but if you specify a format? oh it's over for the JSON-only era 😭 the given template gets executed for each result β€” one pass per container, because she's thorough and she does not skip a single one, periodt πŸ’…

πŸ’… OPTIONS πŸ’…

πŸ¦‹ --format, -f=format πŸ¦‹

this is the glow-up button ✨ it formats the output using the given Go template β€” so instead of the whole raw JSON dump you get exactly the little slice of info you asked for. main character energy, tailored to you πŸ‘‘

and here's the iconic part: the keys of the returned JSON can be used as the values for the --format flag. literally just take a key name you saw in the JSON and drop it in there. see examples below, iykyk πŸ“

valid placeholders for the Go template are listed below πŸ‘‡πŸ’–

(...and that's where we're picking up next, bestie β€” the placeholder list is coming right up πŸ§šβ€β™€οΈ)

  • .AppArmorProfile β€” the AppArmor profile, as a string πŸ›‘οΈ
  • .Args β€” the command-line arguments, as an array of strings
  • .BoundingCaps β€” the bounding capability set, as an array of strings
  • .Config ... β€” whole structure with the config info inside, iykyk
  • .ConmonPidFile β€” path to the file holding the conmon pid, a string
  • .Created ... β€” when the container was created, as a string in ISO3601 format ⏰
  • .Dependencies β€” the dependencies, as an array of strings
  • .Driver β€” the storage driver, as a string
  • .EffectiveCaps β€” the effective capability set, as an array of strings
  • .ExecIDs β€” the exec IDs, as an array of strings
  • .GraphDriver ... β€” further details of the graph driver, as a struct
  • .HostConfig ... β€” the host config details, as a struct
  • .HostnamePath β€” path to the file holding the hostname, a string
  • .HostsPath β€” path to the container's /etc/hosts file, a string
  • .ID β€” the container ID, the full 64-char hash πŸ‘‘
  • .Image β€” the container image ID, a 64-char hash
  • .ImageDigest β€” the container image digest, sha256: plus a 64-char hash
  • .ImageName β€” the container image name, a string
  • .IsInfra β€” is this an infra container? string true/false
  • .IsService β€” is this a service container? string true/false
  • .KubeExitCodePropagation β€” the kube exit-code propagation, a string
  • .LockNumber β€” the number of the container's Libpod lock
  • .MountLabel β€” the SELinux label of the mount, a string
  • .Mounts β€” the mounts, as an array of strings
  • .Name β€” the container name, a string ✨
  • .Namespace β€” the container namespace, a string
  • .NetworkSettings ... β€” the network settings, as a struct
  • .OCIConfigPath β€” path to the OCI config file, a string
  • .OCIRuntime β€” the OCI runtime name, a string
  • .Path β€” path to the container command, a string
  • .PidFile β€” path to the file holding the container PID, a string
  • .Pod β€” the parent pod, a string πŸ«›
  • .ProcessLabel β€” the SELinux label of the process, a string
  • .ResolvConfPath β€” path to the container's resolv.conf file, a string
  • .RestartCount β€” how many times the container has been restarted, an int πŸ”
  • .Rootfs β€” the container rootfs, a string
  • .SizeRootFs β€” size of the rootfs, in bytes [1]
  • .SizeRw β€” size of the upper (R/W) container layer, in bytes [1]
  • .State ... β€” container state info (it's a struct, so like, a whole little world inside there 🌸)
  • .StaticDir β€” path to the container metadata dir (a string)
  • .UseImageHostname β€” whether to use /etc/hostname from the image if it exists? (string: true/false)
  • (blank row β€” yes bestie, the original really does have an empty row here, we don't make the rules πŸ’€)
  • .UseImageHosts β€” whether to use /etc/hosts from the image? (string: true/false)
  • (another blank row, serving absolutely nothing but we respect it πŸ‘‘)
[1] This format specifier requires the --size option β€” no --size, no size info, that's the rule fr fr.

✨ OPTIONS ✨

  • --latest, -l β€” instead of typing out a container name or ID like a whole entire paragraph, just grab the last created container 🫢. Quick note though: the last started container can be from other users of Podman on the same host machine, so like, heads up πŸ‘€. (This option is not available with the remote Podman client, including Mac and Windows β€” excluding WSL2 β€” machines. Soz.)
  • --size, -s β€” on top of the normal output, it also shows you the total file size β€” but only if the type is a container πŸ’–.

✨ EXAMPLES ✨

okay so first up, bestie: inspect the specified container and print its information in json format. It’s giving full data-dump main character energy, and we respect it πŸ’…

$ podman container inspect foobar
[
    {
        "Id": "99f66530fe9c7249f7cf29f78e8661669d5831cbe4ee80ea757d5e922dd6a8a6",
        "Created": "2021-09-16T06:09:08.936623325-04:00",
        "Path": "echo",
        "Args": [
            "hi"
        ],
        "State": {
            "OciVersion": "1.0.2-dev",
            "Status": "exited",
            "Running": false,
            "Paused": false,
            "Restarting": false,
            "OOMKilled": false,
            "Dead": false,
            "Pid": 0,
            "ExitCode": 0,
            "Error": "",
            "StartedAt": "2021-09-16T06:09:09.033564436-04:00",
            "FinishedAt": "2021-09-16T06:09:09.036184314-04:00",
            "Healthcheck": {
                "Status": "",
                "FailingStreak": 0,
                "Log": null
            }
        },
        "Image": "14119a10abf4669e8cdbdff324a9f9605d99697215a0d21c360fe8dfa8471bab",
        "ImageName": "docker.io/library/alpine:latest",
        "Rootfs": "",
        "Pod": "",
        "ResolvConfPath": "/run/user/3267/containers/overlay-containers/99f66530fe9c7249f7cf29f78e8661669d5831cbe4ee80ea757d5e922dd6a8a6/userdata/resolv.conf",
        "HostnamePath": "/run/user/3267/containers/overlay-containers/99f66530fe9c7249f7cf29f78e8661669d5831cbe4ee80ea757d5e922dd6a8a6/userdata/hostname",
        "HostsPath": "/run/user/3267/containers/overlay-containers/99f66530fe9c7249f7cf29f78e8661669d5831cbe4ee80ea757d5e922dd6a8a6/userdata/hosts",
        "StaticDir": "/home/dwalsh/.local/share/containers/storage/overlay-containers/99f66530fe9c7249f7cf29f78e8661669d5831cbe4ee80ea757d5e922dd6a8a6/userdata",
        "OCIConfigPath": "/home/dwalsh/.local/share/containers/storage/overlay-containers/99f66530fe9c7249f7cf29f78e8661669d5831cbe4ee80ea757d5e922dd6a8a6/userdata/config.json",
        "OCIRuntime": "crun",
        "ConmonPidFile": "/run/user/3267/containers/overlay-containers/99f66530fe9c7249f7cf29f78e8661669d5831cbe4ee80ea757d5e922dd6a8a6/userdata/conmon.pid",
        "PidFile": "/run/user/3267/containers/overlay-containers/99f66530fe9c7249f7cf29f78e8661669d5831cbe4ee80ea757d5e922dd6a8a6/userdata/pidfile",
        "Name": "foobar",
        "RestartCount": 0,
        "Driver": "overlay",
        "MountLabel": "system_u:object_r:container_file_t:s0:c25,c695",
        "ProcessLabel": "system_u:system_r:container_t:s0:c25,c695",
        "AppArmorProfile": "",
        "EffectiveCaps": [
            "CAP_CHOWN",
            "CAP_DAC_OVERRIDE",
            "CAP_FOWNER",
            "CAP_FSETID",
            "CAP_KILL",
            "CAP_NET_BIND_SERVICE",
            "CAP_SETFCAP",
            "CAP_SETGID",
            "CAP_SETPCAP",
            "CAP_SETUID",
        ],
        "BoundingCaps": [
            "CAP_CHOWN",
            "CAP_DAC_OVERRIDE",
            "CAP_FOWNER",
            "CAP_FSETID",
            "CAP_KILL",
            "CAP_NET_BIND_SERVICE",
            "CAP_SETFCAP",
            "CAP_SETGID",
            "CAP_SETPCAP",
            "CAP_SETUID",
        ],
        "ExecIDs": [],
        "GraphDriver": {
            "Name": "overlay",
            "Data": {
                "LowerDir": "/home/dwalsh/.local/share/containers/storage/overlay/e2eb06d8af8218cfec8210147357a68b7e13f7c485b991c288c2d01dc228bb68/diff",
                "UpperDir": "/home/dwalsh/.local/share/containers/storage/overlay/8f3d70434a3db17410ec4710caf4f251f3e4ed0a96a08124e4b3d4af0a0ea300/diff",
                "WorkDir": "/home/dwalsh/.local/share/containers/storage/overlay/8f3d70434a3db17410ec4710caf4f251f3e4ed0a96a08124e4b3d4af0a0ea300/work"
            }
        },
        "Mounts": [],
        "Dependencies": [],
        "NetworkSettings": {
            "EndpointID": "",
            "Gateway": "",
            "IPAddress": "",
            "IPPrefixLen": 0,
            "IPv6Gateway": "",
            "GlobalIPv6Address": "",
            "GlobalIPv6PrefixLen": 0,
            "MacAddress": "",
            "Bridge": "",
            "SandboxID": "",
            "HairpinMode": false,
            "LinkLocalIPv6Address": "",
            "LinkLocalIPv6PrefixLen": 0,
            "Ports": {},
            "SandboxKey": ""
        },
        "Namespace": "",
        "IsInfra": false,
        "Config": {
            "Hostname": "99f66530fe9c",
            "Domainname": "",
            "User": "",
            "AttachStdin": false,
            "AttachStdout": false,
            "AttachStderr": false,
            "Tty": false,
            "OpenStdin": false,
            "StdinOnce": false,
            "Env": [
                "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
                "TERM=xterm",
                "container=podman",
                "HOME=/root",
                "HOSTNAME=99f66530fe9c"
            ],
            "Cmd": [
                "echo",
                "hi"
            ],
            "Image": "docker.io/library/alpine:latest",
            "Volumes": null,
            "WorkingDir": "/",
            "Entrypoint": "",
            "OnBuild": null,
            "Labels": null,
            "Annotations": {
                "io.container.manager": "libpod",
                "io.kubernetes.cri-o.Created": "2021-09-16T06:09:08.936623325-04:00",
                "org.opencontainers.image.stopSignal": "15"
            },
            "StopSignal": 15,
            "CreateCommand": [
                "podman",
                "run",
                "--name",
                "foobar",
                "alpine",
                "echo",
                "hi"
            ],
            "Timezone": "local",
            "Umask": "0022",
            "Timeout": 0,
            "StopTimeout": 10
        },
        "HostConfig": {
            "Binds": [],
            "CgroupManager": "systemd",
            "CgroupMode": "private",
            "ContainerIDFile": "",
            "LogConfig": {
                "Type": "journald",
                "Config": null,
                "Path": "",
                "Tag": "",
                "Size": "0B"
            },
            "NetworkMode": "pasta",
            "PortBindings": {},
            "RestartPolicy": {
                "Name": "",
                "MaximumRetryCount": 0
            },
            "AutoRemove": false,
            "VolumeDriver": "",
            "VolumesFrom": null,
            "CapAdd": [],
            "CapDrop": [],
            "Dns": [],
            "DnsOptions": [],
            "DnsSearch": [],
            "ExtraHosts": [],
            "GroupAdd": [],
            "IpcMode": "shareable",
            "Cgroup": "",
            "Cgroups": "default",
            "Links": null,
            "OomScoreAdj": 0,
            "PidMode": "private",
            "Privileged": false,
            "PublishAllPorts": false,
            "ReadonlyRootfs": false,
            "SecurityOpt": [],
            "Tmpfs": {},
            "UTSMode": "private",
            "UsernsMode": "",
            "ShmSize": 65536000,
            "Runtime": "oci",
            "ConsoleSize": [
                0,
                0
            ],
            "Isolation": "",
            "CpuShares": 0,
            "Memory": 0,
            "NanoCpus": 0,
            "CgroupParent": "user.slice",
            "BlkioWeight": 0,
            "BlkioWeightDevice": null,
            "BlkioDeviceReadBps": null,
            "BlkioDeviceWriteBps": null,
            "BlkioDeviceReadIOps": null,
            "BlkioDeviceWriteIOps": null,
            "CpuPeriod": 0,
            "CpuQuota": 0,
            "CpuRealtimePeriod": 0,
            "CpuRealtimeRuntime": 0,
            "CpusetCpus": "",
            "CpusetMems": "",
            "Devices": [],
            "DiskQuota": 0,
            "KernelMemory": 0,
            "MemoryReservation": 0,
            "MemorySwap": 0,
            "MemorySwappiness": null,
            "OomKillDisable": false,
            "PidsLimit": 2048,
            "Ulimits": [],
            "CpuCount": 0,
            "CpuPercent": 0,
            "IOMaximumIOps": 0,
            "IOMaximumBandwidth": 0,
            "CgroupConf": null
        }
    }
]

Next: inspect the specified container for the Image Name it is based on. Ask for exactly that field and let it slay 🌸

$ podman container inspect nervous_fermi --format "{{.ImageName}}"
registry.access.redhat.com/ubi8:latest

Then: inspect the specified container for the GraphDriver Name it is running with. One field, zero drama, iconic behavior πŸŽ€

$ podman container inspect foobar --format "{{.GraphDriver.Name}}"
overlay

And last example: inspect the latest container created for its EffectiveCaps field. (This option is not available with the remote Podman client, including Mac and Windows (excluding WSL2) machines) β€” yes bestie, that caveat stays in the notes 🫢

$ podman container inspect --latest --format {{.EffectiveCaps}}
[CAP_CHOWN CAP_DAC_OVERRIDE CAP_FOWNER CAP_FSETID CAP_KILL CAP_NET_BIND_SERVICE CAP_SETFCAP CAP_SETGID CAP_SETPCAP CAP_SETUID]

πŸ”— SEE ALSO πŸ”—

Go read these next, fr fr:


πŸŽ€ HISTORY πŸŽ€

Sep 2021, Originally compiled by Dan Walsh dwalsh@redhat.com ⟨mailto:dwalsh@redhat.com⟩ β€” iconic origin story, no cap πŸ˜­πŸ‘‘


okay that’s the whole page bestie! footer love: it’s podman-container-inspect(1) from the General Commands Manual, with a Sep 2021 date stamp πŸ’–βœ¨

πŸ“¦ where this page comes from