Search code examples
dockerimagehashdockerfilerepository

Identify FROM line from Docker Image


I have an image from a colleague and the original version of the Dockerfile was lost that was used to create it.

I used alpine/dfimage to rebuild everything in the Dockerfile except the first line (FROM).

According to Artifactory, the digest for the layer is

{
    "mediaType": "application/vnd.docker.image.rootfs.diff.tar.gzip",
    "size": 2813316,
    "digest": "sha256:cbdbe7a5bc2a134ca8ec91be58565ec07d037386d1f1d8385412d224deafca08"
}

and the ADD line is:

ADD file:b91adb67b670d3a6ff9463e48b7def903ed516be66fc4282d22c53e41512be49 in /

I'm fairly confident the base image was pulled from a public repo. I've been trying to find a way of searching Docker Hub for images by digest (like I can in Artifactory), but I've yet to identify something. For example, library/apline:3.15.0 has a digest of sha256:21a3deaa0d32a8057914f36584b5288d2e5ecc984380bc0118285c70fa8c9300 (different from the repo digest of sha256:c74f1b1166784193ea6c8f9440263b9be6cae07dfe35e32a5df7a31358ac2060 as advertised on Docker Hub).

If I knew the namespace and repo, I could simply specify the digest with docker image pull server/namespace/repo@digest. Unfortunately, the only thing I have is a previous version of the Dockerfile and the namespace and repo referenced there didn't work.

FROM mcr.microsoft.com/dotnet/core/runtime:2.1.11-alpine3.9

In other words, docker image pull mcr.microsoft.com/dotnet/core/runtime@sha256:cbdbe7a5bc2a134ca8ec91be58565ec07d037386d1f1d8385412d224deafca08 did not return success. Nor did docker image pull mcr.microsoft.com/dotnet/runtime@sha256:cbdbe7a5bc2a134ca8ec91be58565ec07d037386d1f1d8385412d224deafca08.

Any help would be greatly appreciated. My only alternative at this point is to reinvent the wheel.


Solution

  • So, I was able to find this, but none of the data I have seem to correlate and I'd welcome a discussion on it if there is, in fact, any correlating data.

    The image of interest is alpine:3.11.6 with a digest of sha256:9a839e63dad54c3a6d1834e29692c8492d93f90c59c978c1ed79109ea4fb9a54.