我想构建一个 docker 容器并将其从我的 Github 存储库推送到 Github 容器注册表。也许值得一提的是存储库位于一个组织中。这是我的 Github Action 工作流程:
name: <name>
on:
push:
branches:
- server
jobs:
login:
runs-on: ubuntu-latest
steps:
- name: login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: create image from repository
run: docker build -t ghcr.io/${{ github.actor }}/<img-name> .
- name: push image to GitHub Container Registry
run: docker push ghcr.io/${{ github.actor }}/<img-name>:latest
通过login
,但build
失败并出现以下错误:
The push refers to repository [ghcr.io/<user>/<img-name>]
2059ea815744: Preparing
8e3db2b6bb5e: Preparing
5aaeefe84632: Preparing
908e917b0525: Preparing
dff5b20a51e8: Preparing
407c3ac1f7e9: Preparing
e12889c39beb: Preparing
8d3ac3489996: Preparing
e12889c39beb: Waiting
8d3ac3489996: Waiting
407c3ac1f7e9: Waiting
denied: unauthenticated: User cannot be authenticated with the token provided.
Error: Process completed with exit code 1.
我查找了许多解决方案,但没有一个有效。我错过了什么吗?