Docker镜像分析(三)

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 <IMAGE ID>查看镜像

docker history 3afd47092a0e
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
3afd47092a0e        10 weeks ago        /bin/sh -c #(nop)  CMD ["/bin/bash"]            0 B                 
<missing>           10 weeks ago        /bin/sh -c #(nop)  LABEL name=CentOS Base Ima   0 B                 
<missing>           10 weeks ago        /bin/sh -c #(nop) ADD file:d6a1da927f0b7a7100   196.6 MB


3、docker inspect <IMAGE ID>查看镜像

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"


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值