github docker image push denied: permission_denied: write_package
Getting github error message and this reall "shed" light into the error :D
denied: permission_denied: write_package
Then i notice the build pipeline using this docker image and hence the error.
#18 naming to ghcr.io/kepungnzai/dot-net-gw:dac4bad done
So github is actually expecting ghrc + user name + repository name + your image name
Example of pipeline
name: Build and Deploy Azure Function
on:
push:
branches:
- main
workflow_dispatch:
env:
AZURE_FUNCTIONAPP_NAME: 'your-function-app-name' # set this to your function app name on Azure
CONTAINER_REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}/dotnetgw
jobs:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4
- name: 'Login to GitHub Container Registry'
uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: 'Build and push image'
run: |
docker build . -t ${{ env.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
docker push ${{ env.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
- name: 'Login to Azure'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Deploy to Azure Functions'
uses: azure/functions-action@v1
with:
app-name: ${{ env.AZURE_FUNCTIONAPP_NAME }}
image: ${{ env.CONTAINER_REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
Results
The push refers to repository [ghcr.io/kepungnzai/dotnetgw]
8883527407fe: Preparing
Comments