docker

docker desktop如何第一次创建镜像

2023-04-25  本文已影响0人  小KKKKKKKK

根据业务需要,需要使用centos环境,但是安装的docker desktop没有任务镜像可用

登录docker hub去查询需要的镜像文件

image-20230425155738667.png

搜索centos

image-20230425155758530.png image-20230425155839477.png

点击Tags

image-20230425155908383.png

先选择复制对应的拉去命令“docker pull centos:latest”

那么问题来了,我直接执行命令,拉取的到底是什么架构的镜像,这里可以尝试拉取一次

win + r --> cmd

docker pull centos:latest

返回

latest: Pulling from library/centos
a1d0c7532777: Pull complete
Digest: sha256:a27fd8080b517143cbbbab9dfb7c8571c40d67d534bbdee55bd6c473f432b177
Status: Downloaded newer image for centos:latest
docker.io/library/centos:latest

看起来只会拉去第一个架构的镜像

如果我们需要拉取非第一个镜像那该怎么操作?

这里我们选择arm64/v8的镜像

找到对应的DIGEST:sha256:65a4aad1156d8a0679537cb78519a17eb7142e05a968b26a5361153006224fdc

image-20230425165347981.png

拉取的命令就改成

docker pull centos:latest@sha256:65a4aad1156d8a0679537cb78519a17eb7142e05a968b26a5361153006224fdc

返回

docker.io/library/centos@sha256:65a4aad1156d8a0679537cb78519a17eb7142e05a968b26a5361153006224fdc: Pulling from library/centos
52f9ef134af7: Pull complete
Digest: sha256:65a4aad1156d8a0679537cb78519a17eb7142e05a968b26a5361153006224fdc
Status: Downloaded newer image for centos@sha256:65a4aad1156d8a0679537cb78519a17eb7142e05a968b26a5361153006224fdc
docker.io/library/centos:latest@sha256:65a4aad1156d8a0679537cb78519a17eb7142e05a968b26a5361153006224fdc

拉取完成

确认镜像是否存在

docker images

返回

REPOSITORY   TAG       IMAGE ID       CREATED         SIZE
centos       latest    5d0da3dc9764   19 months ago   231MB
centos       <none>    e6a0117ec169   19 months ago   272MB

拉取完成

上一篇下一篇

猜你喜欢

热点阅读