Docker不能在代理后面工作

时间:2017-12-02 12:13:26

标签: docker proxy

不幸的是,我无法在代理服务器后面使用我的docker,我会使用google搜索建议,这是我运行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/"

有什么问题? 谢谢你:))

2 个答案:

答案 0 :(得分: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以重新加载守护进程。

然后重启你的码头:

运行$ sudo systemctl restart docker

答案 1 :(得分:0)

在某些国家/地区无法使用Docker,因为美国实施了一些不公平的制裁,这些制裁直接针对人们,也针对初创企业...

任何方式都可以使用注册表docker而不是docker_hub。 但是,要从微服务和项目创建图像和容器并运行它们(本地),请选中此Link

一切顺利:)