Merge pull request #45564 from vvoland/fix-45556-24

[24.0 backport] api/inspect: Fix nil RepoTags and RepoDigests
This commit is contained in:
Brian Goff 2023-05-18 11:32:14 -07:00 committed by GitHub
commit ea662c5c8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -282,6 +282,14 @@ func (ir *imageRouter) toImageInspect(img *image.Image) (*types.ImageInspect, er
comment = img.History[len(img.History)-1].Comment
}
// Make sure we output empty arrays instead of nil.
if repoTags == nil {
repoTags = []string{}
}
if repoDigests == nil {
repoDigests = []string{}
}
return &types.ImageInspect{
ID: img.ID().String(),
RepoTags: repoTags,