國內(nèi)環(huán)境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 -
#設(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
#設(shè)置docker 自啟動服務(wù)
systemctl enable docker.service
systemctl daemon-reload
systemctl restart docker.service