查找 registry-1.docker.io:没有这样的主机 [英] lookup registry-1.docker.io: no such host

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

问题描述

我的 Ubuntu 16.4 服务器上运行着 docker 守护进程

我的服务器详细信息:

<块引用>

没有可用的 LSB 模块.分销商 ID: Ubuntu描述:Ubuntu 17.04 版本:17.04 代号:zesty

我收到以下错误:

aa@aaa-VirtualBox:/etc/default$ docker run hello-world无法在本地找到图像 'hello-world:latest'docker:来自守护进程的错误响应:获取 https://registry-1.docker.io/v2/:拨号 tcp:查找 registry-1.docker.io:没有这样的主机.请参阅docker run --help".

我已经设置了 http_proxy 和 https_proxy 因为我在公司代理/防火墙后面

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

解决方案

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

创建一个名为 /etc/systemd/system/docker.service.d/10_docker_proxy.conf 的文件,内容如下

[服务]环境=HTTP_PROXY=http://1.1.1.1:111环境=HTTPS_PROXY=http://1.1.1.1:111

<块引用>

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

然后执行以下命令重启docker

sudo systemctl daemon-reload须藤 systemctl 重启 docker

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

I have docker daemon running on my Ubuntu 16.4 server

my server details:

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

I'm receiving the following error:

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'.

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?

解决方案

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.

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

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

Then execute below commands to restart docker

sudo systemctl daemon-reload
sudo systemctl restart docker

Now use your docker run command and it should work

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

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