Create a new Personal access token with the following permissions:
delete:packages
read:packages
write:packages
Make a note of the access token returned.
Next, use access token with docker login
, where USERNAME
is your GitHub username:
$ echo "ACCESS_TOKEN" | docker login ghcr.io -u USERNAME --password-stdin
To push an image, where OWNER
is your username/organisation name:
$ docker tag IMAGE_NAME:TAG_NAME ghcr.io/OWNER/IMAGE_NAME:TAG_NAME
$ docker push ghcr.io/OWNER/IMAGE_NAME:TAG_NAME
Where a Container registry package has been shared to a GitHub repository, executred workflows within this repository now automatically gain access. From within a workflow run step:
- name: Login to Container registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | \
docker login ghcr.io -u "${{ github.actor }}" --password-stdin
- https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry
- https://docs.github.com/en/packages/managing-github-packages-using-github-actions-workflows/publishing-and-installing-a-package-with-github-actions#upgrading-a-workflow-that-accesses-a-registry-using-a-personal-access-token