Docker inspect 命令

 

docker inspect : 获取容器/镜像的元数据。

语法

docker inspect [OPTIONS] NAME|ID [NAME|ID...]

OPTIONS说明:

  • -f :指定返回值的模板文件。

  • -s :显示总的文件大小。

  • --type :为指定类型返回JSON。

实例

获取镜像mysql:latest的元信息。

[root@node1 ~]# docker inspect mysql:latest
[
{
"Id": "sha256:0716d6ebcc1a61c5a296fcb187e71f93531e510d4e4400267e2e502103d0194c",
"RepoTags": [
"mysql:latest"
],
"RepoDigests": [
"mysql@sha256:99e0989e7e3797cfbdb8d51a19d32c8d286dd8862794d01a547651a896bcf00c"
],
"Parent": "",
"Comment": "",
"Created": "2021-09-03T07:24:57.3195538Z",
"Container": "4d9c9240ab2e61cee08cefb683ff1cf2dfb0ce578b3831c54366f0e0f144b2a6",
"ContainerConfig": {
"Hostname": "4d9c9240ab2e",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {},
"33060/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.12",
"MYSQL_MAJOR=8.0",
"MYSQL_VERSION=8.0.26-1debian10"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"mysqld\"]"
],
"Image": "sha256:a976a30b759ca376fc345688cb19cb5f8b3e5600bc88840c8044d60ec4f5d989",
"Volumes": {
"/var/lib/mysql": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "20.10.7",
"Author": "",
"Config": {
"Hostname": "",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"3306/tcp": {},
"33060/tcp": {}
},
"Tty": false,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"GOSU_VERSION=1.12",
"MYSQL_MAJOR=8.0",
"MYSQL_VERSION=8.0.26-1debian10"
],
"Cmd": [
"mysqld"
],
"Image": "sha256:a976a30b759ca376fc345688cb19cb5f8b3e5600bc88840c8044d60ec4f5d989",
"Volumes": {
"/var/lib/mysql": {}
},
"WorkingDir": "",
"Entrypoint": [
"docker-entrypoint.sh"
],
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 513797734,
"VirtualSize": 513797734,
"GraphDriver": {
"Name": "devicemapper",
"Data": {
"DeviceId": "153",
"DeviceName": "docker-253:1-26195353-aa2f0bb15d64a7974f4fc12662357d4b69880dd9330604bdaba63fbbb5607dce",
"DeviceSize": "10737418240"
}
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:d000633a56813933cb0ac5ee3246cf7a4c0205db6290018a169d7cb096581046",
"sha256:731f7c21360385893ff752e1200bf901f7936f973801eb6f10dc81f249920994",
"sha256:b2830993d63aac4a4c4c3cdea0ccae39c14d53e69d82d4a6541b35670431f244",
"sha256:97a2a3481f0d61f26f855842ffb8170680a68659ab724042b3a000941a5a0a4e",
"sha256:35e94dafc854af4a22dd101bc5f6b0b453c91d50ef9893228ae9b41d5fd99226",
"sha256:2eaac5532d4479e5e821f724c854b8bc38527708ff484397b841561e21a8fc9a",
"sha256:89638afc97cdd7709e24a927a87520751464fbb3af9b564e591f0a783b6276fc",
"sha256:cf0cecb7358f93f27a0e1c25b7d4ffbf8a503a027730341a01a6f052816e6846",
"sha256:16c71bbd693d487b5e68a4afcc10536dbb6e8e38311d9a3df6d17a4e2ba00ccb",
"sha256:46bb27bfe16570fffa8627e1d21bf315f0c999239b2f72bd7a05594c73eb72ff",
"sha256:2ecd2889304a49cfb06d3c36698b4bcb67845e9aac671192a4636c2891ab1e06",
"sha256:bc3da4909d7537e8cf0bb1e408d752ee66ff62a2e0eb4f876bcef12c398cf477"
]
}
}
]

 

 
上一篇:测试服mysql突然崩溃


下一篇:c# 实现操作系统 “运行” 功能