英文:
Error: buildx failed with: ERROR: failed to solve: failed to push ghcr.io/: unexpected status: 403 Forbidden
问题
我正在使用GitHub Actions来构建和推送一个简单的Docker镜像到GitHub容器注册表。我的存储库位于一个组织中,并且我已经在组织级别配置了机密。
作业在登录到ghcr时成功,但在尝试将其推送到ghcr时出现以下错误:
错误:buildx失败,错误为:ERROR: failed to solve: failed to push ghcr.io/: unexpected status: 403 Forbidden.
github-actions.yml
name: 构建并推送Freeradius代理
on:
push:
branches:
- '*'
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: 检出代码
uses: actions/checkout@v2
with:
token: ${{ secrets.GCR_TOKEN }}
- name: 设置Docker Buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: 登录到GHCR
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ghcr.io
username: ${{ secrets.REPO_OWNER }}
password: ${{ secrets.GCR_TOKEN }}
- name: 构建并推送Docker镜像
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
我尝试使用不同版本的docker/setup-buildx-action
,但它没有起作用!
英文:
I am using GitHub Actions, for building and pushing a simple docker image to GitHub Container registry. My repository is inside an organization and I have configured secrets on organization level.
The job succeeds in logging in to ghcr, but when it tries to push it to ghcr it end with the following error:
> Error: buildx failed with: ERROR: failed to solve: failed to push ghcr.io/: unexpected status: 403 Forbidden.
github-actions.yml
name: Build and Push Freeradius proxy
on:
push:
branches:
- '*'
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
- name: Checkout Code
uses: actions/checkout@v2
with:
token: ${{ secrets.GCR_TOKEN}}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
- name: Login to GHCR
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ghcr.io
username: ${{ secrets.REPO_OWNER }}
password: ${{ secrets.GCR_TOKEN }}
- name: Build and Push Docker Image
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: true
tags: ghcr.io/${{ github.repository }}:${{ github.sha }}
I tried using different versions of docker/setup-buildx-action
but it didn't worked!
答案1
得分: 1
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论