docker/cli · info · cancelledErr
containers prune has been cancelled
Error message
containers prune has been cancelled
What it means
Returned by pruneFn in cli/command/container/prune.go, the container pruner registered with `docker system prune`. When the shared pruner framework calls it with options.Confirmed=false it acts as a dry-run: it returns the confirmation message ('all stopped containers') plus this cancelledErr sentinel so the system-prune orchestrator knows this pruner needs confirmation and has not run yet. It signals control flow, not a failure.
Source
Thrown at cli/command/container/prune.go:107
out.WriteString(id + "\n")
}
spaceReclaimed = res.Report.SpaceReclaimed
}
return spaceReclaimed, out.String(), nil
}
type cancelledErr struct{ error }
func (cancelledErr) Cancelled() {}
// pruneFn calls the Container Prune API for use in "docker system prune",
// and returns the amount of space reclaimed and a detailed output string.
func pruneFn(ctx context.Context, dockerCLI command.Cli, options pruner.PruneOptions) (uint64, string, error) {
if !options.Confirmed {
// Dry-run: perform validation and produce confirmation before pruning.
confirmMsg := "all stopped containers"
return 0, confirmMsg, cancelledErr{errors.New("containers prune has been cancelled")}
}
return runPrune(ctx, dockerCLI, pruneOptions{
force: true,
filter: options.Filter,
})
}
View on GitHub (pinned to e9452d6e78)
Solutions
- Confirm the `docker system prune` prompt with 'y', or pass --force to skip confirmation entirely
- If only stopped containers should be removed, run `docker container prune -f` directly
- Treat this error as a cancellation sentinel (it implements a Cancelled() method), not a daemon failure — no cleanup occurred
Example fix
# before docker system prune # declined at prompt -> containers prune has been cancelled # after docker system prune --force
When it happens
Trigger: `docker system prune` invoking the container pruneFn before the user has confirmed the aggregate prompt (options.Confirmed=false); declining the `docker system prune` confirmation so the container-prune stage is reported as cancelled.
Common situations: Seen when a user declines the `docker system prune` prompt, or in non-interactive environments where the prompt cannot be answered; occasionally surfaces in logs of tooling that wraps system prune without --force.
Related errors
- container prune has been cancelled
- builder prune has been cancelled
- conflicting options: cannot specify both --network-alias and
- valid streams are STDIN, STDOUT and STDERR
- conflicting options: cannot specify both --timeout and --tim
AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01).
Data as JSON: /data/errors/f4193f26cb033b3c.json.
Report an issue: GitHub.