docker学习总结:Error response from daemon …… request canceled while waiting for connection

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/guangyacyb/article/details/85243160

刚安装完docker,执行docker -v 等等命令都没有问题,但是尝试简单例子的时候:

docker run hello-world

报错:

Unable to find image 'hello-world:latest' locally
docker: 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).

网上很多文章提到的都是代理的问题,例如:

Cannot download Docker images behind a proxy

文章里的方法是创建并修改代理配置文件:

/etc/systemd/system/docker.service.d/http-proxy.conf

这个我试了一下貌似不行,但是还有一种方法是修改以下文件:

sudo vi /etc/default/docker

加入内容:

DOCKER_OPTS="$DOCKER_OPTS --insecure-registry=xxxxxxxxx"
export HTTP_PROXY=http://xxxxxxx:8080
export HTTPS_PROXY=http://xxxxxx:8080
export NO_PROXY=xxxxxxxx

重启docker服务:

sudo service docker restart

然后就可以了:

docker run hello-world

这里的方法应该适用于用代理访问网络的环境~

猜你喜欢

转载自blog.csdn.net/guangyacyb/article/details/85243160