尝试从Minikube上的docker hub拉/运行docker镜像失败 [英] Trying to pull/run docker images from docker hub on Minikube fails

查看:241
本文介绍了尝试从Minikube上的docker hub拉/运行docker镜像失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Kuberetes还是陌生的,以前我已经与docker做了一些工作.我正在尝试完成以下任务:

I am very new to Kuberetes and I have done some work with docker previously. I am trying to accomplish following:

  1. 启动Minikube
  2. 使用Kube-ctl从Docker中心启动docker映像.

我开始了minikube,看起来一切正常.然后我通过以下命令

I started minikube and things look like they are up and running. Then I pass following command

kubectl运行nginx --image = nginx(请注意,我的计算机上任何地方都没有此图像,我希望k8能为我获取它)

kubectl run nginx --image=nginx (Please note I do not have this image anywhere on my machine and I am expecting k8 to fetch it for me)

现在,当我这样做时,它会旋转吊舱,但状态为 ImagePullBackOff .因此,我在其上运行了 kubectl describe pod 命令,结果如下:

Now, when I do that, it spins up the pod but the status is ImagePullBackOff. So I ran kubectl describe pod command on it and the results look like following:

Events:
  Type     Reason     Age              From               Message
  ----     ------     ----             ----               -------
  Normal   Scheduled  8m               default-scheduler  Successfully assigned default/ngix-67c6755c86-qm5mv to minikube
  Warning  Failed     8m               kubelet, minikube  Failed to pull image "nginx": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.64.1:53: read udp 192.168.64.2:52133->192.168.64.1:53: read: connection refused
  Normal   Pulling    8m (x2 over 8m)  kubelet, minikube  Pulling image "nginx"
  Warning  Failed     8m (x2 over 8m)  kubelet, minikube  Error: ErrImagePull
  Warning  Failed     8m               kubelet, minikube  Failed to pull image "nginx": rpc error: code = Unknown desc = Error response from daemon: Get https://registry-1.docker.io/v2/: dial tcp: lookup registry-1.docker.io on 192.168.64.1:53: read udp 192.168.64.2:40073->192.168.64.1:53: read: connection refused
  Normal   BackOff    8m (x3 over 8m)  kubelet, minikube  Back-off pulling image "nginx"
  Warning  Failed     8m (x3 over 8m)  kubelet, minikube  Error: ImagePullBackOff

然后我四处寻找是否有人遇到过类似的问题,结果发现有人遇到了,他们确实通过使用更多如下所示的标志重新启动minikube来解决了该问题:

Then I searched around to see if anyone has faced similar issues and it turned out that some people have and they did resolve it by restarting minikube using some more flags which look like below:

minikube start --vm-driver ="xhyve" --insecure-registry ="$ REG_IP":80

当我在Minikube中执行 nslookup 时,它会使用以下信息进行解析:

when I do nslookup inside Minikube, it does resolve with following information:

Server:         10.12.192.22
Address:        10.12.192.22#53

Non-authoritative answer:
hub.docker.com  canonical name = elb-default.us-east-1.aws.dckr.io.
elb-default.us-east-1.aws.dckr.io       canonical name = us-east-1-elbdefau-1nlhaqqbnj2z8-140214243.us-east-1.elb.amazonaws.com.
Name:   us-east-1-elbdefau-1nlhaqqbnj2z8-140214243.us-east-1.elb.amazonaws.com
Address: 52.205.36.130
Name:   us-east-1-elbdefau-1nlhaqqbnj2z8-140214243.us-east-1.elb.amazonaws.com
Address: 3.217.62.246
Name:   us-east-1-elbdefau-1nlhaqqbnj2z8-140214243.us-east-1.elb.amazonaws.com
Address: 35.169.212.184

仍然没有运气.我在这儿做错什么了吗?

still no luck. Is there anything that I am doing wrong here?

推荐答案

错误消息表明,在minikube VM中运行的Docker守护进程无法解析 registry-1.docker.io 主机名因为它配置为用于DNS解析( 192.168.64.1:53 )的DNS名称服务器拒绝连接.令我奇怪的是,Docker守护进程试图通过位于 192.168.64.1 的名称服务器来解析 registry-1.docker.io ,但是当您 nslookup 在VM上,它正在使用 10.12.192.22 上的名称服务器.我在互联网上搜索了"minkube获取注册表-1.docker.io/v2:拨打tcp:在192.168.64.1:53上查找注册表-1.docker.io",发现一个问题,有人将

There error message suggests that the Docker daemon running in the minikube VM can't resolve the registry-1.docker.io hostname because the DNS nameserver it's configured to use for DNS resolution (192.168.64.1:53) is refusing connection. It's strange to me that the Docker deamon is trying to resolve registry-1.docker.io via a nameserver at 192.168.64.1 but when you nslookup on the VM it's using a nameserver at 10.12.192.22. I did an Internet search for "minkube Get registry-1.docker.io/v2: dial tcp: lookup registry-1.docker.io on 192.168.64.1:53" and found an issue where someone made this comment, seems identical to your problem, and seems specific to xhyve.

此人在评论中说:

此问题的确看起来像是Virtualbox中未见的xhyve问题.

This issue does look like an xhyve issue not seen with virtualbox.

切换到 virtualbox 可以为我解决此问题.

我停止了minikube,删除了它,没有-vm-driver = xhyve (默认情况下minikube使用virtualbox驱动程序)启动了它,然后 docker build -t hello-node:v1.正常运行,没有错误

I stopped minikube, deleted it, started it without --vm-driver=xhyve (minikube uses virtualbox driver by default), and then docker build -t hello-node:v1 . worked fine without errors

这篇关于尝试从Minikube上的docker hub拉/运行docker镜像失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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