docker查看镜像信息

这里我们用inspect来查看镜像的详细信息:

[[email protected] ~]# docker inspect ubuntu:14.04
[
{
"Id": "sha256:2c5e00d77a67934d5e39493477f262b878f127b9c01b491f06d8f06f78819578",
"RepoTags": [
"ubuntu:14.04"
],
"RepoDigests": [
"[email protected]:2f7c79927b346e436cc14c92bd4e5bd778c3bd7037f35bc639ac1589a7acfa90"
],
"Parent": "",
"Comment": "",
"Created": "2019-05-15T21:21:13.96007615Z",
"Container": "0da171ebca7c967d1bc6e8bb0bc12658c5b2c8cc242c9c86f503dae0684a5cc7",
"ContainerConfig": {
"Hostname": "0da171ebca7c",
"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"
],
"Cmd": [
"/bin/sh",
"-c",
"#(nop) ",
"CMD [\"/bin/bash\"]"
],
"ArgsEscaped": true,
"Image": "sha256:a0e29d6506d3d6bde4f245645bfce94e023175da5b3a7148e7a1e5b1cdf2ab42",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {}
},
"DockerVersion": "18.06.1-ce",
"Author": "",
"Config": {
"Hostname": "",
"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"
],
"Cmd": [
"/bin/bash"
],
"ArgsEscaped": true,
"Image": "sha256:a0e29d6506d3d6bde4f245645bfce94e023175da5b3a7148e7a1e5b1cdf2ab42",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": null
},
"Architecture": "amd64",
"Os": "linux",
"Size": 188195735,
"VirtualSize": 188195735,
"GraphDriver": {
"Data": {
"LowerDir": "/var/lib/docker/overlay2/f1ce38d27bf85c64a91d2610e41abe786102add90f473e78d67e6484ba16dcc2/diff:/var/lib/docker/overlay2/1b08fc557849915df74ab00bb5713f1a60acc1840a64761b00f0bbf120a8764f/diff:/var/lib/docker/overlay2/110c2f7213e0c2dfcf85bba64cf55013d025b67989b7ba462bfb4fe965be2f5a/diff",
"MergedDir": "/var/lib/docker/overlay2/df358c4c61da87acfd356cc080f55378fe1d0810d6bcc876181f5b96f3c56743/merged",
"UpperDir": "/var/lib/docker/overlay2/df358c4c61da87acfd356cc080f55378fe1d0810d6bcc876181f5b96f3c56743/diff",
"WorkDir": "/var/lib/docker/overlay2/df358c4c61da87acfd356cc080f55378fe1d0810d6bcc876181f5b96f3c56743/work"
},
"Name": "overlay2"
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:b057ab380990c219581e3b074919413ebe31079cbd0d615f63872c471b4dc633",
"sha256:46c1a22ffea5a01eaa8ee679a13536a88e11a85921d83e141abd495be842740b",
"sha256:48334332ed8d6feb5dbd618924c4f02fce7e2b571d96dc93e1f2ba6961881202",
"sha256:66285ac4bf2430aeab0c55a77e630fe10018a8318df59b6e8734f8820b95b0c6"
]
},
"Metadata": {
"LastTagTime": "0001-01-01T00:00:00Z"
}
}
]

这样看太累了,也不需要这么详细的信息,可以只用-f来查看,也方便用第三方工具来获取信息

[[email protected] ~]# docker inspect -f '{{.Created}}' ubuntu:14.04
2019-05-15T21:21:13.96007615Z

也可以加点内容

[[email protected] ~]# docker inspect -f '这个镜像的创建时间: {{.Created}}' ubuntu:14.04
这个镜像的创建时间: 2019-05-15T21:21:13.96007615Z

也可以把格式输出为json,方便三方程序读取

[[email protected] ~]# docker inspect --format='{{json .Config}}' ubuntu:14.04
{"Hostname":"","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"],"Cmd":["/bin/bash"],"ArgsEscaped":true,"Image":"sha256:a0e29d6506d3d6bde4f245645bfce94e023175da5b3a7148e7a1e5b1cdf2ab42","Volumes":null,"WorkingDir":"","Entrypoint":null,"OnBuild":null,"Labels":null}
[[email protected] ~]# docker inspect --format='{{json .GraphDriver}}' ubuntu:14.04
{"Data":{"LowerDir":"/var/lib/docker/overlay2/f1ce38d27bf85c64a91d2610e41abe786102add90f473e78d67e6484ba16dcc2/diff:/var/lib/docker/overlay2/1b08fc557849915df74ab00bb5713f1a60acc1840a64761b00f0bbf120a8764f/diff:/var/lib/docker/overlay2/110c2f7213e0c2dfcf85bba64cf55013d025b67989b7ba462bfb4fe965be2f5a/diff","MergedDir":"/var/lib/docker/overlay2/df358c4c61da87acfd356cc080f55378fe1d0810d6bcc876181f5b96f3c56743/merged","UpperDir":"/var/lib/docker/overlay2/df358c4c61da87acfd356cc080f55378fe1d0810d6bcc876181f5b96f3c56743/diff","WorkDir":"/var/lib/docker/overlay2/df358c4c61da87acfd356cc080f55378fe1d0810d6bcc876181f5b96f3c56743/work"},"Name":"overlay2"}

 

 

 

此条目发表在Docker分类目录,贴了标签。将固定链接加入收藏夹。

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注