Docker下载镜像出现missing signature key问题处理

本文描述了在CentOS系统中更新Docker到最新版本,并使用Docker构建一个新的Nginx镜像的过程,包括解决签名错误和依赖包管理。
摘要由CSDN通过智能技术生成
[root@localhost tetstnginx]# docker build -t nginx:v1 .
Sending build context to Docker daemon 2.048 kB
Step 1/2 : FROM nginx:latest
Trying to pull repository docker.io/library/nginx ... 
missing signature key

查看docker版本:

[root@localhost tetstnginx]# docker version
Client:
 Version:         1.13.1
 API version:     1.26
 Package version: docker-1.13.1-210.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Mar 20 16:04:34 2024
 OS/Arch:         linux/amd64

Server:
 Version:         1.13.1
 API version:     1.26 (minimum version 1.12)
 Package version: docker-1.13.1-210.git7d71120.el7.centos.x86_64
 Go version:      go1.10.3
 Git commit:      7d71120/1.13.1
 Built:           Wed Mar 20 16:04:34 2024
 OS/Arch:         linux/amd64
 Experimental:    false

卸载低版本docker:

[root@localhost tetstnginx]# yum erase docker \
>                   docker-client \
>                   docker-client-latest \
>                   docker-common \
>                   docker-latest \
>                   docker-latest-logrotate \
>                   docker-logrotate \
>                   docker-selinux \
>                   docker-engine-selinux \
>                   docker-engine \
>                   docker-ce

安装新版本docker:

[root@localhost tetstnginx]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
Loaded plugins: fastestmirror, langpacks, product-id, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

adding repo from: http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
grabbing file http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
[root@localhost tetstnginx]# yum -y install docker-ce
Loaded plugins: fastestmirror, langpacks, product-id, search-disabled-repos, subscription-manager

This system is not registered with an entitlement server. You can use subscription-manager to register.

Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
docker-ce-stable                                                                                                                     | 3.5 kB  00:00:00     
(1/2): docker-ce-stable/7/x86_64/primary_db                                                                                          | 145 kB  00:00:00     
(2/2): docker-ce-stable/7/x86_64/updateinfo                                                                                          |   55 B  00:00:00     
Resolving Dependencies
--> Running transaction check
---> Package docker-ce.x86_64 3:26.1.0-1.el7 will be installed
--> Processing Dependency: container-selinux >= 2:2.74 for package: 3:docker-ce-26.1.0-1.el7.x86_64
--> Processing Dependency: containerd.io >= 1.6.24 for package: 3:docker-ce-26.1.0-1.el7.x86_64
--> Processing Dependency: docker-ce-cli for package: 3:docker-ce-26.1.0-1.el7.x86_64
--> Processing Dependency: docker-ce-rootless-extras for package: 3:docker-ce-26.1.0-1.el7.x86_64
--> Running transaction check
---> Package container-selinux.noarch 2:2.119.2-1.911c772.el7_8 will be installed
---> Package containerd.io.x86_64 0:1.6.31-3.1.el7 will be installed
---> Package docker-ce-cli.x86_64 1:26.1.0-1.el7 will be installed
--> Processing Dependency: docker-buildx-plugin for package: 1:docker-ce-cli-26.1.0-1.el7.x86_64
--> Processing Dependency: docker-compose-plugin for package: 1:docker-ce-cli-26.1.0-1.el7.x86_64
---> Package docker-ce-rootless-extras.x86_64 0:26.1.0-1.el7 will be installed
--> Running transaction check
---> Package docker-buildx-plugin.x86_64 0:0.14.0-1.el7 will be installed
---> Package docker-compose-plugin.x86_64 0:2.26.1-1.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

============================================================================================================================================================
 Package                                     Arch                     Version                                      Repository                          Size
============================================================================================================================================================
Installing:
 docker-ce                                   x86_64                   3:26.1.0-1.el7                               docker-ce-stable                    27 M
Installing for dependencies:
 container-selinux                           noarch                   2:2.119.2-1.911c772.el7_8                    extras                              40 k
 containerd.io                               x86_64                   1.6.31-3.1.el7                               docker-ce-stable                    35 M
 docker-buildx-plugin                        x86_64                   0.14.0-1.el7                                 docker-ce-stable                    14 M
 docker-ce-cli                               x86_64                   1:26.1.0-1.el7                               docker-ce-stable                    15 M
 docker-ce-rootless-extras                   x86_64                   26.1.0-1.el7                                 docker-ce-stable                   9.4 M
 docker-compose-plugin                       x86_64                   2.26.1-1.el7                                 docker-ce-stable                    13 M

Transaction Summary
============================================================================================================================================================
Install  1 Package (+6 Dependent packages)

Total download size: 114 M
Installed size: 400 M
Downloading packages:
(1/7): container-selinux-2.119.2-1.911c772.el7_8.noarch.rpm                                                                          |  40 kB  00:00:00     
(2/7): containerd.io-1.6.31-3.1.el7.x86_64.rpm                  14% [=======-                                             ] 2.0 MB/s |  16 MB  00:00:47 ETA (2/7): containerd.io-1.6.31-3.1.el7.x86_64.rpm                  14% [=======-                                             ] 2.1 Mwarning: /var/cache/yum/x86_64/7/docker-ce-stable/packages/docker-buildx-plugin-0.14.0-1.el7.x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID 621e9f35: NOKEY
Public key for docker-buildx-plugin-0.14.0-1.el7.x86_64.rpm is not installed
(2/7): docker-buildx-plugin-0.14.0-1.el7.x86_64.rpm                                                       |  14 MB  00:00:11     
(4/7): docker-ce-26.1.0-1.el7.x86_64.rpm                        48% [==========================                            ] 2.3 MB/s |  55 MB  00:00:25 ETA 

(3/7): containerd.io-1.6.31-3.1.el7.x86_64.rpm                  49% [==========================-                           ] 2.3 MB/s |  56 MB  00:00:25 ETA 


(3/7): containerd.io-1.6.31-3.1.el7.x86_64.rpm                  49% [==========================-                           ] 2.3 MB/s |  57 MB  00:00:24 ETA 

(3/7): containerd.io-1.6.31-3.1.el7.x86_64.rpm                  50% [===========================                           ] 2.3 MB/s |  58 MB  00:00:23 ETA 


(3/7): containerd.io-1.6.31-3.1.el7.x86_64.rpm                  51% [===========================-                          ] 2.3 MB/s |  58 MB  00:00:23 ETA 
(3/7): containerd.io-1.6.31-3.1.el7.x86_64.rpm                                                                                        |  35 MB  00:00:28     
(4/7): docker-ce-26.1.0-1.el7.x86_64.rpm                                                                                              |  27 MB  00:00:26     
(5/7): docker-ce-cli-26.1.0-1.el7.x86_64.rpm                                                                                          |  15 MB  00:00:11     
(6/7): docker-ce-rootless-extras-26.1.0-1.el7.x86_64.rpm                                                                              | 9.4 MB  00:00:08     
(7/7): docker-compose-plugin-2.26.1-1.el7.x86_64.rpm                                                                                  |  13 MB  00:00:11     
-------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                        2.2 MB/s | 114 MB  00:00:50     
Retrieving key from https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Importing GPG key 0x621E9F35:
 Userid     : "Docker Release (CE rpm) <docker@docker.com>"
 Fingerprint: 060a 61c5 1b55 8a7f 742b 77aa c52f eb6b 621e 9f35
 From       : https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                        1/7 
setsebool:  SELinux is disabled.
  Installing : containerd.io-1.6.31-3.1.el7.x86_64                                                                                                       2/7 
  Installing : docker-buildx-plugin-0.14.0-1.el7.x86_64                                                                                                  3/7 
  Installing : docker-compose-plugin-2.26.1-1.el7.x86_64                                                                                                 4/7 
  Installing : 1:docker-ce-cli-26.1.0-1.el7.x86_64                                                                                                       5/7 
  Installing : docker-ce-rootless-extras-26.1.0-1.el7.x86_64                                                                                             6/7 
  Installing : 3:docker-ce-26.1.0-1.el7.x86_64                                                                                                           7/7 
  Verifying  : docker-compose-plugin-2.26.1-1.el7.x86_64                                                                                                 1/7 
  Verifying  : 3:docker-ce-26.1.0-1.el7.x86_64                                                                                                           2/7 
  Verifying  : 1:docker-ce-cli-26.1.0-1.el7.x86_64                                                                                                       3/7 
  Verifying  : docker-buildx-plugin-0.14.0-1.el7.x86_64                                                                                                  4/7 
  Verifying  : docker-ce-rootless-extras-26.1.0-1.el7.x86_64                                                                                             5/7 
  Verifying  : 2:container-selinux-2.119.2-1.911c772.el7_8.noarch                                                                                        6/7 
  Verifying  : containerd.io-1.6.31-3.1.el7.x86_64                                                                                                       7/7 

Installed:
  docker-ce.x86_64 3:26.1.0-1.el7                                                                                                                            

Dependency Installed:
  container-selinux.noarch 2:2.119.2-1.911c772.el7_8     containerd.io.x86_64 0:1.6.31-3.1.el7               docker-buildx-plugin.x86_64 0:0.14.0-1.el7     
  docker-ce-cli.x86_64 1:26.1.0-1.el7                    docker-ce-rootless-extras.x86_64 0:26.1.0-1.el7     docker-compose-plugin.x86_64 0:2.26.1-1.el7    

Complete!
[root@localhost tetstnginx]# 

重新执行创建镜像:

[root@localhost tetstnginx]# docker build -t nginx:v1 .
[+] Building 2.3s (6/6) FINISHED                                                                                  docker:default
 => [internal] load build definition from Dockerfile                                                                        0.0s
 => => transferring dockerfile: 100B                                                                                        0.0s
 => [internal] load metadata for docker.io/library/nginx:latest                                                             2.0s
 => [internal] load .dockerignore                                                                                           0.0s
 => => transferring context: 2B                                                                                             0.0s
 => CACHED [1/2] FROM docker.io/library/nginx:latest@sha256:c4ac237ad2675ab27ba42390a9b83dbe90b21fe94342076279cb911e8a498c  0.0s
 => [2/2] RUN echo  "test" > /usr/share/nginx/html/index.html                                                               0.2s
 => exporting to image                                                                                                      0.0s
 => => exporting layers                                                                                                     0.0s
 => => writing image sha256:e0bc0106a8d5540806a4b56ce06e09a041a6fd79af7beab94d3b8e3109227a52                                0.0s
 => => naming to docker.io/library/nginx:v1                                                                                 0.0s
[root@localhost tetstnginx]# 

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值