docker/cli · info · cancelledErr
volume prune has been cancelled
Error message
volume prune has been cancelled
What it means
Returned by docker CLI's `docker volume prune` (runPrune in cli/command/volume/prune.go) when the interactive confirmation prompt is answered with anything other than yes. The error is wrapped in cancelledErr, which implements a Cancelled() marker interface so the CLI can exit without treating it as a hard failure. It exists to make user-declined prunes distinguishable from real errors.
Source
Thrown at cli/command/volume/prune.go:89
func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) (spaceReclaimed uint64, output string, _ error) {
pruneFilters := command.PruneFilters(dockerCli, options.filter.Value())
warning := unusedVolumesWarning
if options.all {
if _, ok := pruneFilters["all"]; ok {
return 0, "", invalidParamErr{errors.New("conflicting options: cannot specify both --all and --filter all=1")}
}
pruneFilters.Add("all", "true")
warning = allVolumesWarning
}
if !options.force {
r, err := prompt.Confirm(ctx, dockerCli.In(), dockerCli.Out(), warning)
if err != nil {
return 0, "", err
}
if !r {
return 0, "", cancelledErr{errors.New("volume prune has been cancelled")}
}
}
res, err := dockerCli.Client().VolumePrune(ctx, client.VolumePruneOptions{
Filters: pruneFilters,
})
if err != nil {
return 0, "", err
}
var out strings.Builder
if len(res.Report.VolumesDeleted) > 0 {
out.WriteString("Deleted Volumes:\n")
for _, id := range res.Report.VolumesDeleted {
out.WriteString(id + "\n")
}
spaceReclaimed = res.Report.SpaceReclaimed
}View on GitHub (pinned to e9452d6e78)
Solutions
- Pass -f/--force to skip the confirmation prompt in scripts and CI: `docker volume prune -f`
- If interactive, answer 'y' at the prompt to proceed
- Treat this exit as a deliberate cancellation, not a failure, when parsing CLI output
Example fix
# before (hangs or cancels in CI) docker volume prune # after docker volume prune -f
When it happens
Trigger: Running `docker volume prune` (or `docker volume prune --all`) without the -f/--force flag and answering 'n' (or anything non-affirmative) at the 'Are you sure you want to continue? [y/N]' prompt; also triggered if stdin is closed/non-interactive so the prompt defaults to No.
Common situations: Scripts or CI pipelines invoking `docker volume prune` without -f, where there is no TTY and the prompt auto-declines; users pressing Enter at the prompt (default is No); wrappers piping empty stdin into the command.
Related errors
- builder prune has been cancelled
- container prune has been cancelled
- system prune has been cancelled
- conflicting options: cannot specify both --all and --filter
- ERROR: The "until" filter is not supported with "--volumes"
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/03b57629a0addacc.json.
Report an issue: GitHub.