centos7 安装阿里云镜像源,并安装docker,并启用阿里云docker加速器
docker版本:docker version 1.12.5
下面脚本中的--registry-mirror=https://1234abcd.mirror.aliyuncs.com
替换为你自己的加速器地址。
申请地址https://dev.aliyun.com/search.html
yum -y install wget
mv -f /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
yum makecache
yum update -y
#curl -fsSL https://get.docker.com/ | sh
curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
sudo cp -n /lib/systemd/system/docker.service /etc/systemd/system/docker.service
sudo sed -i "s|ExecStart=/usr/bin/dockerd|ExecStart=/usr/bin/dockerd --registry-mirror=https://1234abcd.mirror.aliyuncs.com|g" /etc/systemd/system/docker.service
systemctl enable docker.service
systemctl daemon-reload
systemctl restart docker.service
docker run --rm hello-world
请注意 ExecStart替换的是dockerd
,不是docker deamon
DaoCloud 、阿里云 官方网站尚未更正脚本,用了没有效果。
网友评论