CentOS中docker安装及镜像源配置

1、首先配置docker的阿里yum源

cat >/etc/yum.repos.d/docker.repo<<EOF
[docker-ce-edge]
name=Docker CE Edge - \$basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/7/\$basearch/edge
enabled=1
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg
EOF

2、用yum方式安装docker

# yum安装
yum -y install docker-ce

# 查看docker版本
docker --version  

# 启动docker
systemctl enable docker
systemctl start docker

3配置docker多镜像源配置

cat >> /etc/docker/daemon.json << EOF
{
  "registry-mirrors": [
  "https://registry.docker-cn.com",
   "http://hub-mirror.c.163.com",
   "https://docker.mirrors.ustc.edu.cn",
   "https://cr.console.aliyun.com",
   "https://mirror.ccs.tencentyun.com"
  ]
}
EOF

4、重启docker

systemctl restart docker
# 查看docker版本
docker --version  

你可能感兴趣的:(centos,docker,linux)