Why do I get "Error response from daemon: denied" when trying to pull an image from ghcr.io
02:07 10 Aug 2022

I have two repositories. A and B.

Inside A, I have a docker image. Let's say it's name is ghcr.io/org/a

Inside B, I have an action that wants to use this package. Both repos are private.

Here's my action code:

    - name: Log in to GitHub Container Repository
    run: |
      echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
    - name: Pull the image
    run: |
      docker pull ghcr.io/org/a:latest    

As you can see first I log into ghcr.io and I get the Login succeeded message. Then I want to pull the image from my other repo.

But I get this error:

Error response from daemon: denied

However, when I login into ghcr.io from my own machine, I have access to both repositories and I can pull any image from any private repository of mine.

Why GitHub Action from B can not pull image from A in spite of being logged in?

github-actions