报错信息:
查看docker版本
# docker -v
Docker version 1.13.1, build 7d71120/1.13.1
在dockerfile中我使用的基础镜像为
FROM alpine:3.16.5
解决办法是升级docker或者降低Alpine的版本,我这边选择升级docker版本
卸载现有docker版本
# yum -y remove $(rpm -qa | grep docker)
安装需要的依赖包
# sudo yum install -y yum-utils device-mapper-persistent-data lvm2
添加Docker官方GPG密钥
# sudo yum-config-manager --add-repo https://download.docker.com/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: https://download.docker.com/linux/centos/docker-ce.repo
grabbing file https://download.docker.com/linux/centos/docker-ce.repo to /etc/yum.repos.d/docker-ce.repo
repo saved to /etc/yum.repos.d/docker-ce.repo
# sudo rpm --import https://download.docker.com/linux/centos/gpg
安装指定版本的Docker引擎
# sudo yum install -y docker-ce-20.10.18 docker-ce-cli-20.10.18 containerd.io
启动Docker服务并设置开机自启
# systemctl enable --now docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
查看docker版本
# docker -v
Docker version 20.10.18, build b40c2f6
再次编译构建正常