我正在尝试运行docker login
,但是我遇到了以下错误:
Error response from daemon: Get "https://[removed_id_for_stackoverflow].dkr.ecr.us-east-1.amazonaws.com/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
我在我的~/.bash.rc
文件中有以下内容:
export HTTP_PROXY="http://192.168.1.1:8080"
export HTTPS_PROXY="http://192.168.1.1:8080"
export https_proxy="http://192.168.1.1:8080"
export https_proxy="http://192.168.1.1:8080"
export ftp_proxy="http://192.168.1.1:8080"
export no_proxy="localhost,127.0.0.1,::1"
如果我运行
curl https://www.google.com
,那么就会得到一个有效的响应,证实这些设置是有效的。如果我删除这些环境变量,那么我的curl
命令就无法工作,因此我非常确定从环境变量的角度来看它已经正确配置了。根据Docker Hub登录代理,你只需要在运行
docker login
时将代理选项传递到命令行即可;然而,我已经尝试过这个方法,结果还是一样。请见下面的例子:root@my-host:~/.docker# HTTPS_PROXY=http://192.168.1.1:8080 aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin $(aws sts get-caller-identity --output text --query 'Account').dkr.ecr.us-east-1.amazonaws.com >/dev/null
Error response from daemon: Get "https://[removed_for_stack_overflow].dkr.ecr.us-east-1.amazonaws.com/v2/": net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
我尝试将代理设置更改为出现在docker login
之前而不是aws
,尝试使用HTTP_PROXY
而不是HTTPS_PROXY
,但仍然没有运气。似乎无论以哪种顺序指定代理选项都无济于事。
我还有一个名为〜/ .docker / config.json
的文件,其中包含以下代理信息:
{
"proxies":
{
"default":
{
"httpProxy": "http://192.168.1.1:8080",
"httpsProxy": "http://192.168.1.1:8080"
}
}
}
即使设置了这个选项,docker login 似乎仍然无法正常工作,并提供相同的结果。