docker/cli · info · cancelledErr

system prune has been cancelled

Error message

system prune has been cancelled

What it means

Returned by `docker system prune` when the interactive confirmation prompt is answered with anything other than yes. It is wrapped in cancelledErr, which the CLI maps to a non-error-looking cancellation (exit code handling for user aborts), signalling that no pruning was performed.

Source

Thrown at cli/command/system/prune.go:87

Are you sure you want to continue?`

func runPrune(ctx context.Context, dockerCli command.Cli, options pruneOptions) error {
	// prune requires either force, or a user to confirm after prompting.
	confirmed := options.force

	// Validate the given options for each pruner and construct a confirmation-message.
	confirmationMessage, err := dryRun(ctx, dockerCli, options)
	if err != nil {
		return err
	}
	if !confirmed {
		var err error
		confirmed, err = prompt.Confirm(ctx, dockerCli.In(), dockerCli.Out(), confirmationMessage)
		if err != nil {
			return err
		}
		if !confirmed {
			return cancelledErr{errors.New("system prune has been cancelled")}
		}
	}

	var spaceReclaimed uint64
	for contentType, pruneFn := range pruner.List() {
		switch contentType {
		case pruner.TypeVolume:
			if !options.pruneVolumes {
				continue
			}
		case pruner.TypeContainer, pruner.TypeNetwork, pruner.TypeImage, pruner.TypeBuildCache:
			// no special handling; keeping the "exhaustive" linter happy.
		default:
			// other pruners; no special handling; keeping the "exhaustive" linter happy.
		}

		spc, output, err := pruneFn(ctx, dockerCli, pruner.PruneOptions{
			Confirmed: confirmed,

View on GitHub (pinned to e9452d6e78)

Solutions

  1. If pruning was intended non-interactively, pass --force: `docker system prune -f` (add --volumes/-a deliberately, they widen deletion scope).
  2. If you cancelled on purpose, no action needed — nothing was removed.
  3. In scripts, always use -f and explicit filters (e.g. --filter until=24h) rather than relying on prompts.

Example fix

# before (hangs/cancels in CI)
docker system prune

# after
docker system prune -f --filter "until=24h"

When it happens

Trigger: Running `docker system prune` without --force and answering 'N' (or pressing Enter) at the "Are you sure you want to continue?" prompt; also when stdin closes/EOF causes the confirmation to resolve false, e.g. in a non-interactive shell.

Common situations: CI pipelines or cron jobs running `docker system prune` without -f, where there is no TTY so the prompt is auto-declined; users deliberately aborting after reading the warning about what will be deleted.

Related errors


AI-assisted analysis of docker/cli@e9452d6e78 (2026-08-01). Data as JSON: /data/errors/b095329fb0aa9355.json. Report an issue: GitHub.