1、pull镜像有多种方式
(1)docker pull centos@sha256:[digest]
(2)docker pull centos:7.4.1708
可以看到镜像的Digest:
docker pull centos:7.4.1708
Trying to pull repository docker.io/library/centos ...
7.4.1708: Pulling from docker.io/library/centos
18b8eb7e7f01: Pull complete
Digest: sha256:2a61f8abd6250751c4b1dd3384a2bdd8f87e0e60d11c064b8a90e2e552fee2d7
2、docker history
docker history 3afd47092a0e
IMAGE CREATED CREATED BY SIZE COMMENT
3afd47092a0e 10 weeks ago /bin/sh -c #(nop) CMD ["/bin/bash"] 0 B
3、docker inspect
docker inspect 3afd47092a0e
[
{
"Id": "sha256:3afd47092a0ef2877da88b5dad059a0a86ac6d64bead3d4b95b6ff0583cf1239",
"RepoTags": [
"docker.io/centos:7.4.1708"
],
"RepoDigests": [
"docker.io/centos@sha256:2a61f8abd6250751c4b1dd3384a2bdd8f87e0e60d11c064b8a90e2e552fee2d7"
],
"Parent": "",
"Comment": "",
"Created": "2017-11-03T22:32:24.528901673Z",
"Container": "f2004f44e3a04d01e40f542bce45f665d38fdce4234acd66dc457569b510fd3f",
"ContainerConfig": {
"Hostname": "f2004f44e3a0",
"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:0cb9574686084a14274aec10da675afdeec0ddcda71674b7f056d2ba88ff8874",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"build-date": "20170911",
"license": "GPLv2",
"name": "CentOS Base Image",
"vendor": "CentOS"
}
},
"DockerVersion": "17.06.2-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:0cb9574686084a14274aec10da675afdeec0ddcda71674b7f056d2ba88ff8874",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": null,
"OnBuild": null,
"Labels": {
"build-date": "20170911",
"license": "GPLv2",
"name": "CentOS Base Image",
"vendor": "CentOS"
}
},
"Architecture": "amd64",
"Os": "linux",
"Size": 196572926,
"VirtualSize": 196572926,
"GraphDriver": {
"Name": "devicemapper",
"Data": {
"DeviceId": "66",
"DeviceName": "docker-253:0-681718-03f5230d2da4b18e05a598e0920f47e520ad316fdac8d3e1e7b856847021bc49",
"DeviceSize": "10737418240"
}
},
"RootFS": {
"Type": "layers",
"Layers": [
"sha256:129b697f70e96b903f2025859be4444624b4a87394e113918a7f855e97a12ae2"
]
}
}
]
#错误
[1]镜像在启动过程中一直失败,查看messages日志发现如下错误:
reinspection: rpc error: code = 2
desc = unable to inspect docker image "sha256:1c58604b7710f4d803bc44da8832e5d3db5d87643d9a45fd4762b6dad9405100"
while inspecting docker container "cddd7307613cbb0882fd5b105bdc771dd2be2f68c9dbdf03509058c6b6b1ec5d":
no such image: "sha256:1c58604b7710f4d803bc44da8832e5d3db5d87643d9a45fd4762b6dad9405100"