reg icon indicating copy to clipboard operation
reg copied to clipboard

Fails to retrieve digest from Red Hat registry

Open lomori opened this issue 6 years ago • 4 comments

See commands below (no credentials needed for that image):

$ reg digest registry.access.redhat.com/rhscl/mysql-57-rhel7 invalid checksum digest format

$ docker pull registry.access.redhat.com/rhscl/mysql-57-rhel7 Using default tag: latest latest: Pulling from rhscl/mysql-57-rhel7 Digest: sha256:6652ef182f61bf1efa25ea101346d6bf72685ac897902a837cf73b200e3a5b2d Status: Image is up to date for registry.access.redhat.com/rhscl/mysql-57-rhel7:latest

version tested: v0.15.8 environment: MacOS High Sierra 10.13.6

lomori avatar Nov 07 '18 18:11 lomori

It seems that the RedHat registry does not add the header Docker-Content-Digest on the response when asking for a manifest which is what reg is checking.

https://github.com/genuinetools/reg/blob/master/registry/digest.go#L38

screen shot 2018-11-08 at 13 11 38

rikkuness avatar Nov 08 '18 13:11 rikkuness

Yes, I've noticed that also. I wonder how the docker cli is doing. It does display it upon pulling so does it need to pull the image to check the digest or is it figuring that out some other way? Regards,Luiz On Thursday, November 8, 2018, 8:09:21 AM EST, Darrian [email protected] wrote:

It seems that the RedHat registry does not add the header Docker-Content-Digest on the response when asking for a manifest which is what reg is checking.

https://github.com/genuinetools/reg/blob/master/registry/digest.go#L38

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

lomori avatar Nov 08 '18 13:11 lomori

The digest is also in the manifest.

I had a go at changing the Digest method to use it from the manifest, which is quite elegant but I'm not sure how that accounts for version 1 manifests.

// Digest returns the digest for an image.
func (r *Registry) Digest(image Image) (digest.Digest, error) {
	if len(image.Digest) > 1 {
		// return early if we already have an image digest.
		return image.Digest, nil
	}

	mf, err := r.ManifestV2(image.Path, image.Reference())
	if err != nil {
		return "", err
	}

	return mf.Config.Digest, nil
}

rikkuness avatar Nov 08 '18 13:11 rikkuness

The digest is also in the manifest.

I had a go at changing the Digest method to use it from the manifest, which is quite elegant but I'm not sure how that accounts for version 1 manifests.

// Digest returns the digest for an image.
func (r *Registry) Digest(image Image) (digest.Digest, error) {
	if len(image.Digest) > 1 {
		// return early if we already have an image digest.
		return image.Digest, nil
	}

	mf, err := r.ManifestV2(image.Path, image.Reference())
	if err != nil {
		return "", err
	}

	return mf.Config.Digest, nil
}

This is not the Digest but the Docker ID.

ricardobranco777 avatar Nov 03 '22 19:11 ricardobranco777