查找注册表-1.docker.io:无此类主机 [英] lookup registry-1.docker.io: no such host

查看:67
本文介绍了查找注册表-1.docker.io:无此类主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Ubuntu 16.4服务器上运行了docker守护进程

I have docker daemon running on my Ubuntu 16.4 server

我的服务器详细信息:


没有LSB模块可用。分发服务器ID:Ubuntu
说明:Ubuntu 17.04版本:17.04代号:zesty

No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 17.04 Release: 17.04 Codename: zesty

我收到以下错误:

aa@aaa-VirtualBox:/etc/default$ docker run hello-world
Unable to find image 'hello-world:latest' locally
docker: Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io: no such host.
See 'docker run --help'.

我已经设置了http_proxy和https_proxy,因为我位于公司代理/防火墙之后

I have set the http_proxy and the https_proxy beacuse i'm behind a corp proxy/firewall

有什么线索可以解决此问题吗?

Any clues how I can fix this issue?

推荐答案

您需要设置Docker守护程序的代理也使用环境变量。由于映像不存在,因此Docker run也在进行docker pull。在您的情况下,代理仅应用于docker run命令,该命令委托给没有代理运行的docker守护程序。

You need to set the proxy for Docker daemon also using environment variable. Docker run is also doing docker pull since the image doesn't exists. In your case the proxy is only applied to the docker run command, which delegates to the docker daemon which is running without proxy.

使用以下命令创建一个名为 /etc/systemd/system/docker.service.d/10_docker_proxy.conf 的文件内容

Create a file named /etc/systemd/system/docker.service.d/10_docker_proxy.conf with below content

[Service]
Environment=HTTP_PROXY=http://1.1.1.1:111
Environment=HTTPS_PROXY=http://1.1.1.1:111




请确保根据您拥有的 1.1.1.1:111 来更新代理只是一个示例

Make sure to update the proxy as per the ones you have 1.1.1.1:111 is just an example

然后执行以下命令以重新启动docker

Then execute below commands to restart docker

sudo systemctl daemon-reload
sudo systemctl restart docker

现在使用您的docker run命令,它应该可以工作

Now use your docker run command and it should work

这篇关于查找注册表-1.docker.io:无此类主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆