gpt4 book ai didi

docker - 尝试从 Minikube 上的 docker hub 拉取/运行 docker 镜像失败

转载 作者:行者123 更新时间:2023-12-02 11:32:12 59 4
gpt4 key购买 nike

我对 Kuberetes 很陌生,之前我已经用 docker 做过一些工作。我正在尝试完成以下工作:

  • 启动 Minikube
  • 使用 Kube-ctl 从 docker hub 启动一个 docker 镜像。

  • 我启动了 minikube,看起来一切正常。然后我通过以下命令

    kubectl run nginx --image=nginx(请注意我的机器上没有这个图像,我希望 k8 为我获取它)

    现在,当我这样做时,它会旋转 pods ,但状态为 ImagePullBackOff .所以我跑了 kubectl describe pod命令,结果如下所示:
    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 来解决它:
    minikube start --vm-driver="xhyve" --insecure-registry="$REG_IP":80
    当我这样做时 nslookup在 Minikube 内部,它确实通过以下信息解析:
    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

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

    最佳答案

    有错误消息表明运行在 minikube VM 中的 Docker 守护进程无法解析 registry-1.docker.io主机名,因为它配置为用于 DNS 解析的 DNS 名称服务器 ( 192.168.64.1:53 ) 拒绝连接。我很奇怪 Docker 守护进程试图解决 registry-1.docker.io通过域名服务器 192.168.64.1但是当你nslookup在 VM 上,它使用的名称服务器位于 10.12.192.22 .我在互联网上搜索了“minkube Get registry-1.docker.io/v2: dial tcp: lookup registry-1.docker.io on 192.168.64.1:53”,发现有人提出了一个问题 this comment ,似乎与您的问题相同,并且似乎特定于 xhyve .

    在该评论中,该人说:

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





    Switching to virtualbox fixed this issue for me.

    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

    关于docker - 尝试从 Minikube 上的 docker hub 拉取/运行 docker 镜像失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57281700/

    59 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com