Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails to retrieve digest from Red Hat registry #161

Open
lomori opened this issue Nov 7, 2018 · 4 comments · May be fixed by #222
Open

Fails to retrieve digest from Red Hat registry #161

lomori opened this issue Nov 7, 2018 · 4 comments · May be fixed by #222

Comments

@lomori
Copy link

lomori commented Nov 7, 2018

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

@rikkuness
Copy link
Contributor

rikkuness commented Nov 8, 2018

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

@lomori
Copy link
Author

lomori commented Nov 8, 2018 via email

@rikkuness
Copy link
Contributor

rikkuness commented Nov 8, 2018

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
}

@ricardobranco777
Copy link

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 ricardobranco777 linked a pull request Nov 3, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants