Docker相关配置记录
换源
{
"registry-mirrors": [
"https://dockerhub.icu",
"https://docker.chenby.cn",
"https://docker.1panel.live",
"https://docker.awsl9527.cn",
"https://docker.anyhub.us.kg",
"https://dhub.kubesre.xyz"
]
}
Docker代理
当前用代理相对靠谱
源换为原来的:
vim /etc/docker/daemon.json
{
"registry-mirrors": [
"https://hub.docker.com/"]
}
设置代理改为对应的配置端口
export https_proxy=http://XXX:7892 http_proxy=http://XXX:7892 all_proxy=socks5://XXX:7890
修改文件 vim /etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=http://XXX:7892"
Environment="HTTPS_PROXY=http://XXX:7892"
重启docker
# 加载配置
systemctl daemon-reload
# 重启docker
systemctl restart docker
# 查看代理配置是否生效
systemctl show --property=Environment docker
##---打印内容---
Environment=HTTP_PROXY=http://XXX:7892 HTTPS_PROXY=http://XXX:7892