共计 707 个字符,预计需要花费 2 分钟才能阅读完成。
本文为演示系统 Rocky Linux release 9.4 (Blue Onyx)
添加阿里yum源
sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo sed -i 's+download.docker.com+mirrors.aliyun.com/docker-ce+' /etc/yum.repos.d/docker-ce.repo
yum makecache
安装最新版Docker
sudo yum install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
配置Docker源,可自行修改
cat >> /etc/docker/daemon.json << EOF
{
"log-driver": "json-file",
"log-opts": {
"max-file": "3",
"max-size": "500m"
},
"data-root":"/data/docker",
"registry-mirrors": [
"https://hub-mirror.c.163.com",
"https://mirror.baidubce.com",
"https://registry.dockermirror.com"
]
}
EOF
重启Docker
systemctl daemon-reload #使配置生效
systemctl restart docker #重启docker
正文完