首页 > 解决方案 > 获取 https://ghrc.io/v2/:net/http: 等待连接时取消请求(等待标头时超出 Client.Timeout)

问题描述

我正在使用 github 操作来构建我的图像并将其推送到 github 注册表。

这是我的部署文件,

name: Build and Push

on:
  push:
    branches:
      - develop

jobs:

 
  build_and_push_to_github_registry:
    runs-on: ubuntu-latest
    steps:
      -
        name: Checkout
        uses: actions/checkout@v2
      - 
        name: Login to Github Container Registry
        uses: docker/login-action@v1
        with:
          registry: ghcr.io
          username: ${{ github.actor }}
          password: ${{ secrets.GITHUB_TOKEN }}
      - name: Build and Push
        uses: docker/build-push-action@v2
        with:
          context: .
          push: true
          target: dev
          tags: ghrc.io/ownerin/customer-service-backend:${{ github.sha }}

这里的所有者是OwnerIN大写字母,但标签不支持大写字母,所以我正在使用ownerin

但是当作业运行时,我得到以下错误。构建成功,推送步骤发生错误。

...
pushing ghrc.io/ownerin/customer-service-backend:0679931b537b724ca21e6ef53178d4bf0725b4b5 with docker:
error: Get https://ghrc.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)
Error: buildx call failed with: error: Get https://ghrc.io/v2/: net/http: request canceled while waiting for connection (Client.Timeout exceeded while awaiting headers)

我按照文档和 repo 描述了here

标签: dockergithubcontinuous-integrationdevopsgithub-actions

解决方案


域名是 ghcr.io(GitHub Container Registry 的缩写),而不是 ghrc.io。这是一个错字,您正在尝试将容器映像推送到 Internet 上的未知主机。


推荐阅读