国内环境docker pull 太慢
本文给出更换阿里云镜像的方法
Rancher
vi /var/lib/rancher/conf/docker
添加--registry-mirror=https://1234abcd.mirror.aliyuncs.com
DOCKER_OPTS='
-H tcp://0.0.0.0:2376
-H unix:///var/run/docker.sock
--storage-driver overlay
--tlsverify
--tlscacert /var/lib/rancher/conf/ca.pem
--tlscert /var/lib/rancher/conf/server.pem
--tlskey /var/lib/rancher/conf/server-key.pem
--label provider=virtualbox
--registry-mirror=https://1234abcd.mirror.aliyuncs.com
'
重启Rancher生效
Boot2Docker
vi /var/lib/boot2docker/profile
添加--registry-mirror=https://1234abcd.mirror.aliyuncs.com
XTRA_ARGS='
--label provider=virtualbox
--registry-mirror=https://1234abcd.mirror.aliyuncs.com
'
CACERT=/var/lib/boot2docker/ca.pem
DOCKER_HOST='-H tcp://0.0.0.0:2376'
DOCKER_STORAGE=aufs
DOCKER_TLS=auto
SERVERKEY=/var/lib/boot2docker/server-key.pem
SERVERCERT=/var/lib/boot2docker/server.pem
重启boot2docker生效
centos 7
#安装docker
curl -sSL http://acs-public-mirror.oss-cn-hangzhou.aliyuncs.com/docker-engine/internet | sh -
#设置docker registry 镜像
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
#设置docker 自启动服务
systemctl enable docker.service
systemctl daemon-reload
systemctl restart docker.service