Vishnu Lakkimsetty
Vishnu Lakkimsetty

Reputation: 198

Why SHA256 digest of Docker image changes if we push the same image with same tag multiple times to the same docker repository

I have created a docker image with a custom tag using Dockerfile. For the first time when I pushed it to docker repository (in Jfrog artifactory) using docker push command, it generated a SHA256 digest value. Now I again pushed the same image with same tag without any change in the content of the image to the same docker repository. But now it generated new SHA256 digest value.

Can someone explain me why this is happening? I'm struck at this point as my project is hardly dependent to SHA256 digest value of the docker image.

Upvotes: 8

Views: 8269

Answers (1)

user1529891
user1529891

Reputation:

Since my comment answered your question, original credit goes to the post here: https://windsock.io/explaining-docker-image-ids/

Layers are identified by a digest in this form: algorithm:hex which looks like sha256:abcd.....

The hex is calculated by applying the algorithm (sha256) to the layers content. If the content changes, then the digest changes.

Upvotes: -3

Related Questions