MCPcopy Index your code
hub / github.com/docker/cli / pruneFn

Function pruneFn

cli/command/image/prune.go:122–138  ·  view source on GitHub ↗

pruneFn calls the Image Prune API for use in "docker system prune", and returns the amount of space reclaimed and a detailed output string.

(ctx context.Context, dockerCLI command.Cli, options pruner.PruneOptions)

Source from the content-addressed store, hash-verified

120// pruneFn calls the Image Prune API for use in "docker system prune",
121// and returns the amount of space reclaimed and a detailed output string.
122func pruneFn(ctx context.Context, dockerCLI command.Cli, options pruner.PruneOptions) (uint64, string, error) {
123 if !options.Confirmed {
124 // Dry-run: perform validation and produce confirmation before pruning.
125 var confirmMsg string
126 if options.All {
127 confirmMsg = "all images without at least one container associated to them"
128 } else {
129 confirmMsg = "all dangling images"
130 }
131 return 0, confirmMsg, cancelledErr{errors.New("image prune has been cancelled")}
132 }
133 return runPrune(ctx, dockerCLI, pruneOptions{
134 force: true,
135 all: options.All,
136 filter: options.Filter,
137 })
138}

Callers 2

runPruneFunction · 0.50
dryRunFunction · 0.50

Calls 1

runPruneFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…