Skip to content

Commit

Permalink
Merge pull request #980 from crazy-max/imageid
Browse files Browse the repository at this point in the history
build: return imageID when loading without docker driver
  • Loading branch information
tonistiigi committed Mar 4, 2022
2 parents 2d5368c + e7863eb commit 8079bd2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions build/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -766,9 +766,12 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do
resp[k] = res[0]
respMu.Unlock()
if len(res) == 1 {
digest := res[0].ExporterResponse["containerimage.digest"]
dgst := res[0].ExporterResponse[exptypes.ExporterImageDigestKey]
if v, ok := res[0].ExporterResponse[exptypes.ExporterImageConfigDigestKey]; ok {
dgst = v
}
if opt.ImageIDFile != "" {
return ioutil.WriteFile(opt.ImageIDFile, []byte(digest), 0644)
return ioutil.WriteFile(opt.ImageIDFile, []byte(dgst), 0644)
}
return nil
}
Expand All @@ -778,7 +781,7 @@ func Build(ctx context.Context, drivers []DriverInfo, opt map[string]Options, do
descs := make([]specs.Descriptor, 0, len(res))

for _, r := range res {
s, ok := r.ExporterResponse["containerimage.digest"]
s, ok := r.ExporterResponse[exptypes.ExporterImageDigestKey]
if ok {
descs = append(descs, specs.Descriptor{
Digest: digest.Digest(s),
Expand Down

0 comments on commit 8079bd2

Please sign in to comment.