MCPcopy Create free account
hub / github.com/containers/common / Inspect

Method Inspect

libimage/inspect.go:62–206  ·  view source on GitHub ↗

Inspect inspects the image.

(ctx context.Context, options *InspectOptions)

Source from the content-addressed store, hash-verified

60
61// Inspect inspects the image.
62func (i *Image) Inspect(ctx context.Context, options *InspectOptions) (*ImageData, error) {
63 logrus.Debugf("Inspecting image %s", i.ID())
64
65 if options == nil {
66 options = &InspectOptions{}
67 }
68
69 if i.cached.completeInspectData != nil {
70 if options.WithSize && i.cached.completeInspectData.Size == int64(-1) {
71 size, err := i.Size()
72 if err != nil {
73 return nil, err
74 }
75 i.cached.completeInspectData.Size = size
76 }
77 if options.WithParent && i.cached.completeInspectData.Parent == "" {
78 parentImage, err := i.Parent(ctx)
79 if err != nil {
80 return nil, err
81 }
82 if parentImage != nil {
83 i.cached.completeInspectData.Parent = parentImage.ID()
84 }
85 }
86 return i.cached.completeInspectData, nil
87 }
88
89 // First assemble data that does not depend on the format of the image.
90 info, err := i.inspectInfo(ctx)
91 if err != nil {
92 return nil, err
93 }
94 ociImage, err := i.toOCI(ctx)
95 if err != nil {
96 return nil, err
97 }
98
99 repoTags, err := i.RepoTags()
100 if err != nil {
101 return nil, err
102 }
103 repoDigests, err := i.RepoDigests()
104 if err != nil {
105 return nil, err
106 }
107 driverData, err := i.driverData()
108 if err != nil {
109 return nil, err
110 }
111
112 size := int64(-1)
113 if options.WithSize {
114 size, err = i.Size()
115 if err != nil {
116 return nil, err
117 }
118 }
119

Callers 6

inspectInfoMethod · 0.95
TestPushOtherPlatformFunction · 0.45
TestImageFunctionsFunction · 0.45
TestInspectHealthcheckFunction · 0.45
TestCorruptedLayersFunction · 0.45

Calls 13

IDMethod · 0.95
SizeMethod · 0.95
ParentMethod · 0.95
inspectInfoMethod · 0.95
toOCIMethod · 0.95
RepoTagsMethod · 0.95
RepoDigestsMethod · 0.95
driverDataMethod · 0.95
DigestMethod · 0.95
NamesHistoryMethod · 0.95
sourceMethod · 0.95
rawConfigBlobMethod · 0.95

Tested by 4

TestPushOtherPlatformFunction · 0.36
TestImageFunctionsFunction · 0.36
TestInspectHealthcheckFunction · 0.36
TestCorruptedLayersFunction · 0.36