背景:
由于本地內網服務器的internet是受限制的(需要配置遠程代理上網,不能直接上網),因此,在使用docker連接docker hub的時候,就會出錯,
docker pull nginx(拉取dockerhub鏡像)
問題一:
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while aw
解決方法:設定Http和Https代理
mkdir -p /etc/systemd/system/docker.service.d
vim /etc/systemd/system/docker.service.d/proxy.conf
[Service]
Environment="HTTP_PROXY=http://192.168.1.9:1080"
Environment="HTTPS_PROXY=https://192.168.1.9:1080"
注:
HTTP_PROXY 和 HTTPS_PROXY 將它的值對應到您設定的代理服務地址和埠
Environment="HTTP_PROXY=http://proxy.example.com:80"
Environment="HTTPS_PROXY=https://proxy.example.com:443"
重繪更改并重新啟動Docker
systemctl daemon-reload
systemctl restart docker
參考檔案:https://docs.docker.com/config/daemon/systemd/
## https://www.cnblogs.com/liucx/
2.設定代理后,仍然無法拉取鏡像
問題二:
Docker pull:TLS握手超時
Error response from daemon: Get https://registry-1.docker.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
但是使用curl TLS可以正常作業
curl https://registry-1.docker.io/v2/
{"errors":[{"code":"UNAUTHORIZED","message":"authentication required","detail":null}]}
在網路上搜索了半天,基本是設定docker加速器或者修改MTU大小
## https://www.cnblogs.com/liucx/
最后解決方法:
將https代理的地址 改成 http//網址
vim /etc/systemd/system/docker.service.d/proxy.conf
Environment="HTTP_PROXY=http://192.168.1.9:1080"
Environment="HTTPS_PROXY=http://192.168.1.9:1080"
重繪更改并重新啟動Docker
systemctl daemon-reload
systemctl restart docker
現在一切正常,希望能幫到您,幫忙點個贊哈
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/278382.html
標籤:其他
上一篇:不用加號的加法
