【问题标题】:Concourse Can't Connect to Docker RepositoryConcourse 无法连接到 Docker 存储库
【发布时间】:2020-03-26 04:03:33
【问题描述】:

我是 concourse 的新手,正在尝试在我的环境中进行设置。我在 Windows 机器上的 Virtualbox 6.1.4 r136177 上运行 Ubuntu 18.04。我设法让节点运行并设置了大厅工作人员,并且我能够成功访问我的大厅仪表板。当我尝试运行本页所述的简单 hello world 管道时出现问题:https://concourse-ci.org/hello-world-example.html

错误说:

[31mERRO [0m[0004] check failed: get remote image: Get https://index.docker.io/v2/: dial tcp: lookup index.docker.io on [::1]:53: read udp [::1]:55989->[::1]:53: read: connection refused

搜索类似错误表明 virtualbox 可能无法连接到 docker 存储库。所以我继续将 docker 安装到我的系统并运行以下命令:

sudo docker run hello-world

但这一次 docker 成功拉取了镜像。所以我认为这不是我的虚拟机的问题。有没有人遇到过同样的问题并找到了解决方案?

更新

以下问题启发我建立自己的注册表: How to use a local docker image as resource in concourse-docker

我已经配置了我的本地 docker 注册表,并通过从我自己的注册表中提取我的图像来验证它是否可以工作。所以我通过修改 hello world 示例配置了一个简单的大厅管道来使用我的注册表:

---
jobs:
  - name: job
    public: true
    plan:
      - task: simple-task
        config:
          platform: linux
          image_resource:
            type: docker-image
            source:
              repository: 127.0.0.1:5000/busybox
              tag: latest
              insecure_registries: [ "127.0.0.1:5000" ]
          run:
            path: echo
            args: ["Hello, world!"]

然后我遇到以下错误:

resource script '/opt/resource/check []' failed: exit status 1

stderr:
failed to ping registry: 2 error(s) occurred:

* ping https: Get https://127.0.0.1:5000/v2: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers
* ping http: Get http://127.0.0.1:5000/v2: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers

【问题讨论】:

    标签: docker continuous-integration concourse


    【解决方案1】:

    127.0.0.1 可能指的是检查容器的 IP,而不是 Concourse 作为工作器运行的机器(除非您将 houdini 作为容器策略)。尝试获取运行 docker 的机器的实际 IP 并尝试。

    【讨论】:

    • 您好,感谢您的回复。你的解释是合乎逻辑的,它可能是这样的。但我想知道我应该在哪里配置这样的设置?一个例子将不胜感激!
    • 哪些设置?确定worker IP还是使用houdini?
    【解决方案2】:

    我遇到了同样的问题。就我而言,concourse worker 安装在 proxmox 内的 qemu VM 上。

    使用fly-t tutorials trigger-job --job hello-world/hello-world-job --watch 命令(在tutorial 中给出)开始工作时,工人回答ERRO[0030] checking origin busybox failed: initialize transport: Get "https://index.docker.io/v2/": dial tcp xx.xx.xx.xx:443: i/o timeout

    表示worker无法访问任何DNS服务器。

    有两种方法可以解决这个问题。

    第一个选项:通过docker-compose 运行所有内容。 docker-compose.yml 具有工人设置:CONCOURSE_GARDEN_DNS_PROXY_ENABLE: "true"。一切正常。但是,我尝试在直接在 VM 内(没有 docker)运行 worker 时指定相同的设置,但这并没有解决问题。

    第二个选项(无 docker): 为您的工作人员使用此设置:

    CONCOURSE_RUNTIME=containerd
    CONCOURSE_CONTAINERD_EXTERNAL_IP=192.168.1.106
    CONCOURSE_CONTAINERD_DNS_SERVER=192.168.1.1
    CONCOURSE_CONTAINERD_ALLOW_HOST_ACCESS=true
    CONCOURSE_CONTAINERD_DNS_PROXY_ENABLE=true
    

    设置这些参数后,我的工作人员可以看到 DNS 服务器并可以访问 docker 注册表。

    192.168.1.106 替换为您在本地网络中的计算机地址。和 192.168.1.1 与您的 DNS 服务器。

    这些参数记录在here。您也可以使用concourse worker --help 命令获取这些描述。

    Containerd Container Networking:
      --containerd-external-ip=                          IP address to use to reach container's mapped ports. Autodetected if not specified. [$CONCOURSE_CONTAINERD_EXTERNAL_IP]
      --containerd-dns-server=                           DNS server IP address to use instead of automatically determined servers. Can be specified multiple times. [$CONCOURSE_CONTAINERD_DNS_SERVER]
      --containerd-restricted-network=                   Network ranges to which traffic from containers will be restricted. Can be specified multiple times. [$CONCOURSE_CONTAINERD_RESTRICTED_NETWORK]
      --containerd-network-pool=                         Network range to use for dynamically allocated container subnets. (default: 10.80.0.0/16) [$CONCOURSE_CONTAINERD_NETWORK_POOL]
      --containerd-mtu=                                  MTU size for container network interfaces. Defaults to the MTU of the interface used for outbound access by the host. [$CONCOURSE_CONTAINERD_MTU]
      --containerd-allow-host-access                     Allow containers to reach the host's network. This is turned off by default. [$CONCOURSE_CONTAINERD_ALLOW_HOST_ACCESS]
    

    【讨论】:

      【解决方案3】:

      我有同样的问题。克隆了这个 repo - https://github.com/concourse/concourse-docker

      按照自述文件中的说明生成密钥,然后使用克隆中的 docker-compose.yml 文件启动 docker 容器。

      【讨论】:

        猜你喜欢
        • 2019-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2019-07-09
        • 2019-06-21
        • 2013-01-07
        • 2014-11-03
        • 1970-01-01
        相关资源
        最近更新 更多