MCPcopy Create free account
hub / github.com/docker/cli / pruneFn

Function pruneFn

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

pruneFn calls the Volume 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 Volume 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 // TODO version this once "until" filter is supported for volumes
124 // Ideally, this check wasn't done on the CLI because the list of
125 // filters that is supported by the daemon may evolve over time.
126 if _, ok := options.Filter.Value()["until"]; ok {
127 return 0, "", errors.New(`ERROR: The "until" filter is not supported with "--volumes"`)
128 }
129 if !options.Confirmed {
130 // Dry-run: perform validation and produce confirmation before pruning.
131 confirmMsg := "all anonymous volumes not used by at least one container"
132 return 0, confirmMsg, cancelledErr{errors.New("volume prune has been cancelled")}
133 }
134 return runPrune(ctx, dockerCli, pruneOptions{
135 force: true,
136 filter: options.Filter,
137 })
138}

Callers

nothing calls this directly

Calls 2

runPruneFunction · 0.70
ValueMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…