名称¶
podman-container-inspect - 显示容器的配置
概要¶
podman container inspect [选项] 容器 [容器 …]
描述¶
这将显示由名称或 ID 标识的容器的低级信息。默认情况下,这将以 JSON 数组形式呈现所有结果。如果指定了格式,则将对每个结果执行给定的模板。
选项¶
--format, -f=格式¶
使用给定的 Go 模板格式化输出。返回的 JSON 的键可以用作 --format 标志的值(见下面的示例)。
Go 模板的有效占位符列在下面
占位符 |
描述 |
---|---|
.AppArmorProfile |
AppArmor 配置文件(字符串) |
.Args |
命令行参数(字符串数组) |
.BoundingCaps |
绑定能力集(字符串数组) |
.Config … |
包含配置信息的结构 |
.ConmonPidFile |
包含 conmon 进程 ID 的文件路径(字符串) |
.Created … |
容器创建时间(字符串,ISO3601) |
.Dependencies |
依赖项(字符串数组) |
.Driver |
存储驱动程序(字符串) |
.EffectiveCaps |
有效能力集(字符串数组) |
.ExecIDs |
执行 ID(字符串数组) |
.GraphDriver … |
图形驱动程序的更多详细信息(结构) |
.HostConfig … |
主机配置详细信息(结构) |
.HostnamePath |
包含主机名的文件路径(字符串) |
.HostsPath |
容器 /etc/hosts 文件的路径(字符串) |
.ID |
容器 ID(完整的 64 字符哈希值) |
.Image |
容器镜像 ID(64 字符哈希值) |
.ImageDigest |
容器镜像摘要(sha256:+64 字符哈希值) |
.ImageName |
容器镜像名称(字符串) |
.IsInfra |
这是一个基础设施容器吗?(字符串:true/false) |
.IsService |
这是一个服务容器吗?(字符串:true/false) |
.KubeExitCodePropagation |
Kube 退出代码传播(字符串) |
.LockNumber |
容器的 Libpod 锁的编号 |
.MountLabel |
挂载的 SELinux 标签(字符串) |
.Mounts |
挂载点(字符串数组) |
.Name |
容器名称(字符串) |
.Namespace |
容器命名空间(字符串) |
.NetworkSettings … |
网络设置(结构) |
.OCIConfigPath |
OCI 配置文件的路径(字符串) |
.OCIRuntime |
OCI 运行时名称(字符串) |
.Path |
容器命令的路径(字符串) |
.PidFile |
包含容器 PID 的文件路径(字符串) |
.Pod |
父 Pod(字符串) |
.ProcessLabel |
进程的 SELinux 标签(字符串) |
.ResolvConfPath |
容器的 resolv.conf 文件的路径(字符串) |
.RestartCount |
容器重启的次数(整数) |
.Rootfs |
容器根文件系统(字符串) |
.SizeRootFs |
根文件系统的大小,以字节为单位 [1] |
.SizeRw |
上层(读写)容器层的大小,以字节为单位 [1] |
.State … |
容器状态信息(结构) |
.StaticDir |
容器元数据目录的路径(字符串) |
[1] 此格式说明符需要 --size 选项
--latest, -l¶
不提供容器名称或 ID,而是使用最后创建的容器。注意:最后启动的容器可能是主机上其他 Podman 用户的容器。(此选项在远程 Podman 客户端(包括 Mac 和 Windows(不包括 WSL2)机器)上不可用)
--size, -s¶
除了正常输出外,还显示总文件大小(如果类型是容器)。
示例¶
检查指定的容器,并以 JSON 格式打印其信息。
$ 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": "slirp4netns",
"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": 0,
"OomKillDisable": false,
"PidsLimit": 2048,
"Ulimits": [],
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"CgroupConf": null
}
}
]
检查指定的容器,以获取其基于的镜像名称。
$ podman container inspect nervous_fermi --format "{{.ImageName}}"
registry.access.redhat.com/ubi8:latest
检查指定的容器,以获取其运行的图形驱动程序名称。
$ podman container inspect foobar --format "{{.GraphDriver.Name}}"
overlay
检查最新创建的容器,以获取其 EffectiveCaps 字段。(此选项在远程 Podman 客户端(包括 Mac 和 Windows(不包括 WSL2)机器)上不可用)
$ 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]
另请参阅¶
历史¶
2021 年 9 月,最初由 Dan Walsh dwalsh@redhat.com 编写