MCPcopy Create free account
hub / github.com/Mirantis/cri-dockerd / imageInspectToRuntimeAPIImageInfo

Function imageInspectToRuntimeAPIImageInfo

core/convert.go:80–113  ·  view source on GitHub ↗
(image *dockertypes.ImageInspect, history []dockerimagetypes.HistoryResponseItem)

Source from the content-addressed store, hash-verified

78}
79
80func imageInspectToRuntimeAPIImageInfo(image *dockertypes.ImageInspect, history []dockerimagetypes.HistoryResponseItem) (map[string]string, error) {
81 info := make(map[string]string)
82
83 createdAt, err := libdocker.ParseDockerTimestamp(image.Created)
84 if err != nil {
85 return nil, err
86 }
87
88 imageSpec := imagespec.Image{
89 Created: &createdAt,
90 Author: image.Author,
91 Platform: imagespec.Platform{
92 Architecture: image.Architecture,
93 OS: image.Os,
94 },
95 Config: toRuntimeAPIConfig(image.Config),
96 RootFS: toRuntimeAPIRootFS(image.RootFS),
97 History: toRuntimeAPIHistory(history),
98 }
99
100 imi := &verboseImageInfo{
101 Labels: image.Config.Labels,
102 ImageSpec: imageSpec,
103 }
104
105 m, err := json.Marshal(imi)
106 if err == nil {
107 info["info"] = string(m)
108 } else {
109 return nil, err
110 }
111
112 return info, nil
113}
114
115type verboseContainerInfo struct {
116 SandboxID string `json:"sandboxID"`

Callers 1

ImageStatusMethod · 0.85

Calls 4

ParseDockerTimestampFunction · 0.92
toRuntimeAPIConfigFunction · 0.85
toRuntimeAPIRootFSFunction · 0.85
toRuntimeAPIHistoryFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…