MCPcopy
hub / github.com/docker/compose / imagesCommand

Function imagesCommand

cmd/compose/images.go:45–60  ·  view source on GitHub ↗
(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions)

Source from the content-addressed store, hash-verified

43}
44
45func imagesCommand(p *ProjectOptions, dockerCli command.Cli, backendOptions *BackendOptions) *cobra.Command {
46 opts := imageOptions{
47 ProjectOptions: p,
48 }
49 imgCmd := &cobra.Command{
50 Use: "images [OPTIONS] [SERVICE...]",
51 Short: "List images used by the created containers",
52 RunE: Adapt(func(ctx context.Context, args []string) error {
53 return runImages(ctx, dockerCli, backendOptions, opts, args)
54 }),
55 ValidArgsFunction: completeServiceNames(dockerCli, p),
56 }
57 imgCmd.Flags().StringVar(&opts.Format, "format", "table", "Format the output. Values: [table | json]")
58 imgCmd.Flags().BoolVarP(&opts.Quiet, "quiet", "q", false, "Only display IDs")
59 return imgCmd
60}
61
62func runImages(ctx context.Context, dockerCli command.Cli, backendOptions *BackendOptions, opts imageOptions, services []string) error {
63 projectName, err := opts.toProjectName(ctx, dockerCli)

Callers 1

RootCommandFunction · 0.85

Calls 3

AdaptFunction · 0.85
runImagesFunction · 0.85
completeServiceNamesFunction · 0.85

Tested by

no test coverage detected