GitHub Action Error: Docker pull failed with exit code 1

GitHub Action Error: Docker pull failed with exit code 1

我正在尝试 运行 我的 npm 在 docker 容器中构建,使用我们的私有 docker 图像和 GitHub 操作。

我的工作流程yaml文件如下,

jobs:
  build:
    runs-on: Linux-self-hosted  # This is our self hosted linux runner system.
    container:
      image: ubuntu-20.04-lts:latest  # This is our private docker image.

    steps:
    - name: Checkout Repository
      uses: actions/checkout@v2
      
    - name: Npm Build
      run: npm install

    - name: Build Package
      run: vsce package

GitHub 操作错误:-

Starting job container /usr/bin/docker pull ubuntu-20.04-lts:latest Error response from daemon: pull access denied for ubuntu-20.04-lts, repository does not exist or may require 'docker login': denied: requested access to the resource is denied Warning: Docker pull failed with exit code 1, back off 4.74 seconds before retry.
/usr/bin/docker pull ubuntu-20.04-lts:latest Error response from daemon: pull access denied for ubuntu-20.04-lts, repository does not exist or may require 'docker login': denied: requested access to the resource is denied Warning: Docker pull failed with exit code 1, back off 9.535 seconds before retry. /usr/bin/docker pull ubuntu-20.04-lts:latest Error response from daemon: pull access denied for ubuntu-20.04-lts, repository does not exist or may require 'docker login': denied: requested access to the resource is denied
Error: Docker pull failed with exit code 1

我在本地主机系统上有这个 ubuntu-20.04-lts:latest 私人 docker 图像。在动作构建期间它仍然失败并出现上述错误。

它看起来正在尝试连接 docker 集线器。我该如何解决这个问题以使用我们的本地私有图像?

您必须将映像推送到您的私有注册表。一旦它在那里,您可以按照 docs:

中的描述为您的私有注册表配置凭据
container:
  image: ghcr.io/owner/image
  credentials:
     username: ${{ github.actor }}
     password: ${{ secrets.ghcr_token }}