docker 默認(rèn)的 image registry 和 kubernetes 中使用的鏡像庫 google registry 都需要翻墻才能拉取,通過以下方法設(shè)置 docker 代理。
- 創(chuàng)建服務(wù)的代理配置文件
sudo -i
mkdir /etc/systemd/system/docker.service.d
nano /etc/systemd/system/docker.service.d/http-proxy.conf
- 在配置文件中添加代理配置內(nèi)容
[Service]
Environment="HTTP_PROXY=http://localhost:64000/" "HTTPS_PROXY=http://localhost:64000/" "NO_PROXY=localhost,127.0.0.1,docker-registry.somecorporation.com"
- 重啟服務(wù)
sudo systemctl daemon-reload
sudo systemctl restart docker
- 測試?yán)?,如果拉取成功,說明配置成功
docker pull k8s.gcr.io/kube-apiserver:v1.12.2