moby / moby/moby

Getting image digest after push

Open
#48,331 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature status/0-triage
Dominant language
Go
Stars
72.1k
Forks
19.2k
Avg merge
1d 18h
Merged PRs (30d)
164

Description

Description

Typically users rely on the Aux field to get at the digest following a successful push using ImagePush. Specifically, something like this can be done on the caller side, note the unmarshal into types.PushResult:

if message.Aux != nil {
	var pushResult types.PushResult
	if err := json.Unmarshal(*message.Aux, &pushResult); err == nil {
		imageDigest = pushResult.Digest
	}
}

However, in some scenarios (when containerd image store is enabled newer cli versions), the digest is returned in the Status as a plain string. And afaics the only way to get at the digest is to parse this raw string?

https://github.com/moby/moby/blob/f9522e5e96c3ab5a6b8a643d15a92700ca864da6/daemon/containerd/image_push.go#L126-L133

So, the question (or feature request), is it possible to standardize on a convention for getting the digest when reading from the io.ReadCloser.

I believe this request is in the same vein as https://github.com/moby/moby/issues/46528, but specifically for push.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with pkg/jsonmessage/jsonmessage.go and daemon/containerd/image_push.go, then compare the Aux-based caller example with the Status response described here. Review issue #46528 for related API context. Done means defining and documenting a consistent way to obtain the digest from ImagePush output across both response paths.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.