Docker在代理后无法工作

7

很不幸,我无法在代理后使用我的docker,我按照谷歌搜索的建议去做,但是当我运行sudo docker run hello-world时,我得到了以下错误:

Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-
1.docker.io/v2/: Proxy Authentication Required.
See 'docker run --help'.

这是我的'/etc/systemd/system/docker.service.d/http-proxy.conf'文件:
[Service]
Environment="HTTP_PROXY=http://user:pass@127.0.0.1:8800/"
Environment="HTTPS_PROXY=https://user:pass@127.0.0.1:8800/"

我的“etc/default/docker”文件:

export http_proxy="http://127.0.0.1:3128/"
export https_proxy="http://127.0.0.1:3128/"
export HTTP_PROXY="http://127.0.0.1:3128/"
export HTTPS_PROXY="http://127.0.0.1:3128/"

问题是什么?谢谢:)


请告诉我您的Docker版本和操作系统? - Saran
添加代理后,您是否执行了 daemon reload 和 docker restart 命令? - Shettyh
@Shettyh 是的,我做了。 - MMRA
@Saran Ubuntu 17.04,Docker版本17.09.0-ce,构建afdb6d4。 - MMRA
2个回答

3

请尝试这个:

$ sudo vim /etc/resolv.conf

#add these lines on top and above one for home router…
nameserver 8.8.8.8
nameserver 8.8.4.4

保存/etc/resolv.conf文件后,

运行$ sudo systemctl daemon-reload重新加载守护进程。

然后重启docker:

运行$ sudo systemctl restart docker


抱歉,我在哪里可以找到Docker日志? - MMRA
@mahshidkhatami,我更新了我的答案。如果你还没有,请看这些步骤。 - Saran

0

由于美国的一些不公平制裁直接针对人们和初创企业,因此在某些国家中无法使用Docker。

你可以使用注册表docker代替docker_hub。但是,如果要从微服务和项目创建图像和容器并运行它们(本地),请检查此链接

祝一切顺利 :)


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接