centos 9 安装 docker centos7 换源
给yum安装不了docker的centos:
Centos 7
yum install -y yum-utils
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y
yum list docker-ce --showduplicates | sort -r
systemctl enable --now docker
参考: https://docs.docker.com/engine/install/centos/
换源
cat <<EOF > /etc/docker/daemon.json
{
"registry-mirrors": [
"https://kfwkfulq.mirror.aliyuncs.com",
"https://2lqq34jg.mirror.aliyuncs.com",
"https://pee6w651.mirror.aliyuncs.com",
"https://registry.docker-cn.com",
"http://hub-mirror.c.163.com"
],
"dns": ["8.8.8.8","8.8.4.4"]
}
EOF
systemctl restart docker
#查看源是否生效↓
docker info
参考:https://blog.51cto.com/u_12831/6307701
centos 9:
yum install -y yum-utils
//国外镜像
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
//阿里镜像
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
yum list docker-ce --showduplicates | sort -r
#在docker-ce-后接指定版本,例如:
yum install -y docker-ce-20.10.9-3.el7
systemctl enable --now docker