Closed omallo closed 7 years ago
I've just seen that this can be accomplished as follows using the Client
exposed by the library:
request, _ := http.NewRequest("HEAD", "https://registry-1.docker.io/v2/library/alpine/manifests/latest", nil)
request.Header.Add("Accept", "application/vnd.docker.distribution.manifest.v2+json")
response, _ := registry.Client.Do(request)
fmt.Println(response.Header["Docker-Content-Digest"][0])
However, I think it would still be nice if this functionality would be exposed by the library itself.
Was looking at this a few weeks ago myself. Came back to check and saw your comment. The Docker Manifest in the library would need to be changed to schema2. But I like how you dealt with it, my solution was dirtier :)
I've created a PR with this feature and manifest deletion: #21
Done in #21.
I've just started using this library and while it works fine for most things, I haven't found a way to retrieve an image's digest. Would it be possible to add this functionality to the library?
Based on the API docs, the digest seems to be delivered in the
Docker-Content-Digest
header.