MCPcopy Create free account
hub / github.com/containerd/nerdctl / printComposeImageIDs

Function printComposeImageIDs

cmd/nerdctl/compose/compose_images.go:106–125  ·  view source on GitHub ↗
(ctx context.Context, containers []containerd.Container)

Source from the content-addressed store, hash-verified

104}
105
106func printComposeImageIDs(ctx context.Context, containers []containerd.Container) error {
107 ids := []string{}
108 for _, c := range containers {
109 image, err := c.Image(ctx)
110 if err != nil {
111 return err
112 }
113 metaImage := image.Metadata()
114 id := metaImage.Target.Digest.String()
115 if !strutil.InStringSlice(ids, id) {
116 ids = append(ids, id)
117 }
118 }
119
120 for _, id := range ids {
121 // always truncate image ids.
122 fmt.Println(strings.Split(id, ":")[1][:12])
123 }
124 return nil
125}
126
127func printComposeImages(ctx context.Context, cmd *cobra.Command, containers []containerd.Container, sn snapshots.Snapshotter, format string) error {
128 type composeImagePrintable struct {

Callers 1

imagesActionFunction · 0.85

Calls 2

InStringSliceFunction · 0.92
StringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…