查询单个容器信息

描述

isula inspect提供了容器的详细信息。

用法

  1. isula inspect [OPTIONS] CONTAINER|IMAGE [CONTAINER|IMAGE...]

参数

inspect命令支持参数参考下表。

表 1 inspect命令参数列表

命令

参数

说明

inspect

-H, —host

指定要连接的iSulad socket文件路径

-f, —format

使用模板格式化输出

-t, —time

超时时间的秒数,若在该时间内inspect查询容器信息未执行成功,则停止等待并立即报错,默认为120秒,当配置小于等于0的值,表示不启用timeout机制inspect查询容器信息会一直等待,直到获取容器信息成功后返回。

约束限制

  • 轻量级容器不支持format为“{{.State}}”的格式化输出,支持“{{json .State}}”的json格式化输出。当inspect镜像时,不支持-f参数。

示例

查询容器信息

  1. $ isula inspect c75284634bee
  2. [
  3. {
  4. "Id": "c75284634beeede3ab86c828790b439d16b6ed8a537550456b1f94eb852c1c0a",
  5. "Created": "2019-08-01T22:48:13.993304927-04:00",
  6. "Path": "sh",
  7. "Args": [],
  8. "State": {
  9. "Status": "running",
  10. "Running": true,
  11. "Paused": false,
  12. "Restarting": false,
  13. "Pid": 21164,
  14. "ExitCode": 0,
  15. "Error": "",
  16. "StartedAt": "2019-08-02T06:09:25.535049168-04:00",
  17. "FinishedAt": "2019-08-02T04:28:09.479766839-04:00",
  18. "Health": {
  19. "Status": "",
  20. "FailingStreak": 0,
  21. "Log": []
  22. }
  23. },
  24. "Image": "busybox",
  25. "ResolvConfPath": "",
  26. "HostnamePath": "",
  27. "HostsPath": "",
  28. "LogPath": "none",
  29. "Name": "c75284634beeede3ab86c828790b439d16b6ed8a537550456b1f94eb852c1c0a",
  30. "RestartCount": 0,
  31. "HostConfig": {
  32. "Binds": [],
  33. "NetworkMode": "",
  34. "GroupAdd": [],
  35. "IpcMode": "",
  36. "PidMode": "",
  37. "Privileged": false,
  38. "SystemContainer": false,
  39. "NsChangeFiles": [],
  40. "UserRemap": "",
  41. "ShmSize": 67108864,
  42. "AutoRemove": false,
  43. "AutoRemoveBak": false,
  44. "ReadonlyRootfs": false,
  45. "UTSMode": "",
  46. "UsernsMode": "",
  47. "Sysctls": {},
  48. "Runtime": "lcr",
  49. "RestartPolicy": {
  50. "Name": "no",
  51. "MaximumRetryCount": 0
  52. },
  53. "CapAdd": [],
  54. "CapDrop": [],
  55. "Dns": [],
  56. "DnsOptions": [],
  57. "DnsSearch": [],
  58. "ExtraHosts": [],
  59. "HookSpec": "",
  60. "CPUShares": 0,
  61. "Memory": 0,
  62. "OomScoreAdj": 0,
  63. "BlkioWeight": 0,
  64. "BlkioWeightDevice": [],
  65. "CPUPeriod": 0,
  66. "CPUQuota": 0,
  67. "CPURealtimePeriod": 0,
  68. "CPURealtimeRuntime": 0,
  69. "CpusetCpus": "",
  70. "CpusetMems": "",
  71. "SecurityOpt": [],
  72. "StorageOpt": {},
  73. "KernelMemory": 0,
  74. "MemoryReservation": 0,
  75. "MemorySwap": 0,
  76. "OomKillDisable": false,
  77. "PidsLimit": 0,
  78. "FilesLimit": 0,
  79. "Ulimits": [],
  80. "Hugetlbs": [],
  81. "HostChannel": {
  82. "PathOnHost": "",
  83. "PathInContainer": "",
  84. "Permissions": "",
  85. "Size": 0
  86. },
  87. "EnvTargetFile": "",
  88. "ExternalRootfs": ""
  89. },
  90. "Mounts": [],
  91. "Config": {
  92. "Hostname": "localhost",
  93. "User": "",
  94. "Env": [
  95. "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
  96. "TERM=xterm",
  97. "PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
  98. ],
  99. "Tty": true,
  100. "Cmd": [
  101. "sh"
  102. ],
  103. "Entrypoint": [],
  104. "Labels": {},
  105. "Annotations": {
  106. "log.console.file": "none",
  107. "log.console.filerotate": "7",
  108. "log.console.filesize": "1MB",
  109. "rootfs.mount": "/var/lib/isulad/mnt/rootfs",
  110. "native.umask": "secure"
  111. },
  112. "HealthCheck": {
  113. "Test": [],
  114. "Interval": 0,
  115. "Timeout": 0,
  116. "StartPeriod": 0,
  117. "Retries": 0,
  118. "ExitOnUnhealthy": false
  119. }
  120. },
  121. "NetworkSettings": {
  122. "IPAddress": ""
  123. }
  124. }
  125. ]