CentOS8安装Docker及配置阿里云镜像

教程以服务器已经成功安装centos8为起始状态

事前准备

yum update

安装所需软件包和Docker CE(设置阿里云仓库)

yum install -y yum-utils
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io

此时你应该会遇到这个问题(containerd.io)

Error:
Problem: package docker-ce-3:19.03.12-3.el7.x86_64 requires containerd.io >= 1.2.2-3, but none of the providers can be installed

解决方法

wget https://download.docker.com/linux/centos/7/x86_64/edge/Packages/containerd.io-1.2.6-3.3.el7.x86_64.rpm
yum install -y  containerd.io-1.2.6-3.3.el7.x86_64.rpm
yum install docker-ce docker-ce-cli containerd.io

启动docker

systemctl start docker

测试

docker -v

配置阿里云镜像加速

浏览器登录 阿里云 获取加速器地址

填入

mkdir -p /etc/docker
tee /etc/docker/daemon.json <<-'EOF'
{
  "registry-mirrors": ["xxx.xxxxx.xx"]
}
EOF

重启生效配置

systemctl daemon-reload 
systemctl restart docker

你可能感兴趣的:(Docker)