'I'm stuck at pushing Docker images to GitHub Container Repository

I'm trying to push a Docker image to ghcr.io. But I'm stuck.

I have created an action on GitHub, that logs into ghcr.io using this code:

echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin

And it passes as a successful step in my GitHub action. I see this response:

Login Succeeded

Then I try to push using this command:

docker push ghcr.io/organization_name/repository_name:latest

And my organization is private. It shows me this error:

denied: installation not allowed to Create organization package
Error: Process completed with exit code 1.

I go to ghcr.io to manually create the repository (just the way we do on Docker Hub), but it's navigation does not have a good UX, at least in my opinion. I click Get Started on their home page, and it takes me to docs page. And when I click Quick Start there, it shows a sample of publishing NPM package. There I see that you should go to your repositories container landing page but I see no link to click to navigate there or no menu item anywhere.

Also I can't find out how to create this package repository using docs

How should I proceed?



Solution 1:[1]

It looks like you have not granted the right permission to the token. You need to give it the write:package permission (can be changed when you open the details of your personal access token).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sebastian P.