Docker Community Forums

Share and learn in the Docker community.

How to check if locally built docker already in docker hub using docker ID/digest?


I am building a github action for a docker build, test, publish pipeline. I am using this action: Build and push Docker images · Actions · GitHub Marketplace · GitHub

The pipeline will be triggered every night to check if there is a need to update the image.

Pipeline will look like this:

  1. build docker locally
  2. Check if image already in docker hub
  3. If yes, stop
  4. If not, test the newly built image
  5. If test is successful tag (with date) and push it docker hub
  6. Tag git repo with same tag as docker image

I face two major issues to build this pipeline:

  1. If I do not use cache in github, as every build environment is prestine, I get a new docker ID for every build for the reason outlined here:

  2. Even if I used cache, how do I reliably check if a newly built image is already in docker hub? I can check newly built Docker ID against, “.config.digest” from docker-hub-remote-api. Is this matching reliable? I would rather check if any layers have changed so that whether I have cache or not the “matching” always work.

Additional questions:

  • I understand docker id is the sha256 of local docker config. How is the docker config used? How is the usage different from docker manifest?
  • What is RepoDigest? How is it created?
  • When are manifest created? If I do “docker inspect” I do not see layer information. The contents of manifest.json and “docker manifest inspect” is totally different.

As a generic question, where can I get more details about docker ID, manifest etc.