You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
nerdctl checkpoint rm requires the container to exist, so a checkpoint whose container was removed can never be removed and its directory stays in the data root #5282
nerdctl checkpoint rm resolves the container argument and refuses to remove
the checkpoint if the container cannot be found — and it does so before it
deletes anything. So a checkpoint whose container has already been removed
cannot be removed with nerdctl at all, and its directory stays in the data root
forever.
The behaviour
$ nerdctl checkpoint rm <gone-container> <checkpoint-name>
error removing checkpoint for container: <gone-container>, no such container
$ echo $?
1
and the checkpoint directory is still there:
$ ls ~/.local/share/nerdctl/checkpoints/
<checkpoint-name>/
The same applies to a checkpoint whose create failed: nothing was stored, and
the removal fails for the same reason.
The source
pkg/cmd/checkpoint/remove.go:
n, err:=walker.Walk(ctx, containerID)
iferr!=nil {
returnerr
} elseifn==0 {
returnfmt.Errorf("error removing checkpoint for container: %s, no such container", containerID)
}
targetPath, err:=checkpointutil.GetCheckpointDir(options.CheckpointDir, checkpointName, container.ID(), false)
iferr!=nil {
returnerr
}
returnos.RemoveAll(targetPath)
The container lookup is a hard precondition for the removal, and it is
resolved beforeos.RemoveAll(targetPath).
Note also that the target path is derived from container.ID() — so the
container's identity is load-bearing for the removal, not merely for the
lookup.
Why this matters
The checkpoint store is a directory of CRIU image files under the nerdctl data root — it is not a containerd object, and the name is not scoped by
container or by namespace. That is a reasonable design (a checkpoint is a
self-contained image set), but it creates a gap: the store outlives both the
container and the namespace, while the only supported removal path requires the
container.
The result is a directory that:
occupies disk in the user's data root (a CRIU image set is not small);
cannot be removed with nerdctl checkpoint rm, because the container it was
named after is gone;
can only be removed by hand, with rm -rf against a path the user has to
reconstruct.
The natural order — remove the container, then the checkpoint — is the order a
user reaches for first, and it is the order that strands the directory. The
working order is the reverse: checkpoint rmthenrm.
Suggested direction
Two independent improvements, either of which closes the gap:
Do not require the container when the checkpoint directory exists. The
container lookup appears to be a guard against removing a checkpoint that
does not exist, but os.RemoveAll on a non-existent path is already
idempotent. If the lookup failed, the removal could still proceed against
the checkpoint directory alone.
Add an explicit "remove by name" path — e.g. allowing the container
argument to be omitted, or a --force/--all mode that removes orphaned
checkpoint directories whose container no longer exists. A nerdctl checkpoint ls that can list a directory with no container would also make the orphan
visible to the user.
checkpoint rm looks up the container before it deletes anything, but the checkpoint directory is only named by the checkpoint. When that directory is still there and the container is gone, removal now deletes the directory. If the directory is gone too, the command still reports that the container does not exist.
Activity
jonyhy96 commentedon Oct 22, 2026
I'll take this.
checkpoint rmlooks up the container before it deletes anything, but the checkpoint directory is only named by the checkpoint. When that directory is still there and the container is gone, removal now deletes the directory. If the directory is gone too, the command still reports that the container does not exist.fix: remove a checkpoint after its container is gone