How to share docker images between the jobs in github actions

I recently moved to GitHub action. Trying to make this work for days but could find a proper solution.

docker

  • In JOB1 I am building Image A and using Image A as a base Image to build Image B .
  • Now Image B will act as a base image to build Image C in JOB2 and Image D in Job3.

I have already tried these 2 solutions but they didn’t work.

  1. Sharing Docker containers between jobs in a workflow · Issue #225 · docker/build-push-action · GitHub
  2. Build images on GitHub Actions with Docker layer caching — Martian Chronicles, Evil Martians’ team blog

Some of the errors I am getting when tried the above solutions:

Error: buildx failed with: error: failed to solve: rpc error: code = Unknown desc = failed to solve with frontend dockerfile.v0: failed to create LLB definition: pull access denied, repository does not exist or may require authorization: server message: insufficient_scope: authorization failed

Can you post your YAML file?