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

Method Containers

libimage/image.go:256–269  ·  view source on GitHub ↗

Containers returns a list of containers using the image.

()

Source from the content-addressed store, hash-verified

254
255// Containers returns a list of containers using the image.
256func (i *Image) Containers() ([]string, error) {
257 var containerIDs []string
258 containers, err := i.runtime.store.Containers()
259 if err != nil {
260 return nil, err
261 }
262 imageID := i.ID()
263 for i := range containers {
264 if containers[i].ImageID == imageID {
265 containerIDs = append(containerIDs, containers[i].ID)
266 }
267 }
268 return containerIDs, nil
269}
270
271// removeContainers removes all containers using the image.
272func (i *Image) removeContainers(options *RemoveImagesOptions) error {

Callers 5

removeContainersMethod · 0.95
defaultNetworkBackendFunction · 0.80
filterContainersFunction · 0.80
TestImageFunctionsFunction · 0.80
diskUsageForImageFunction · 0.80

Calls 1

IDMethod · 0.95

Tested by 1

TestImageFunctionsFunction · 0.64