一、需求背景
docker容器拉取镜像时提示missing signature key.
[
Unable to find image 'redis:latest' locally
Trying to pull repository docker.io/library/redis ...
/usr/bin/docker-current: missing signature key.
See '/usr/bin/docker-current run --help'.
且存在运行中的容器重启后丢失。
初步判断可能是由于docker版本过低导致,遂安装最新版本。
二、重新安装docker
1、处理依赖并添加镜像源
# yum install -y yum-utils device-mapper-persistent-data lvm2
# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
2、查看可按照的版本并执行安装
yum list docker-ce --showduplicates | sort -r
yum -y install docker-ce-26.1.2-1.el7
3、查看版本号并配置国内镜像仓库
[root@XSW yum.repos.d]# docker -v
Docker version 26.1.2, build 211e74b
[root@XSW bin]# cat /etc/docker/daemon.json
{
"registry-mirrors": ["https://docker.mirrors.ustc.edu.cn/","https://hub-mirror.c.163.com","https://registry.docker-cn.com"],
"insecure-registries": ["10.0.0.12:5000"]
}
[root@XSW yum.repos.d]# systemctl start docker
[root@XSW yum.repos.d]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
4、处理拉取容器报错:unknown or invalid runtime name: docker-runc
[
Error response from daemon: unknown or invalid runtime name: docker-runc
解决方案:
# grep -rl 'docker-runc' /var/lib/docker/containers/ | xargs sed -i 's/docker-runc/runc/g'
# systemctl restart docker
5、再次拉取,可以发现恢复正常
[root@XSW yum.repos.d]# docker pull nginx
Using default tag: latest
latest: Pulling from library/nginx
b0a0cf830b12: Already exists
4d84de5fb9b2: Pull complete
2818b7b6a9db: Pull complete
1e5314d67f16: Pull complete
8066e07ce4f2: Pull complete
05f7109fea9e: Pull complete
e58cbd904f7f: Pull complete
Digest: sha256:32e76d4f34f80e479964a0fbd4c5b4f6967b5322c8d004e9cf0cb81c93510766
Status: Downloaded newer image for nginx:latest
docker.io/library/nginx:latest