Skip to content

fix: remove a checkpoint after its container is gone - #5284

Merged
AkihiroSuda merged 1 commit into
containerd:mainfrom
jonyhy96:cursor/checkpoint-rm-orphaned-6b1d
Nov 15, 2026
Merged

AkihiroSuda merged 1 commit into
containerd:mainfrom
jonyhy96:cursor/checkpoint-rm-orphaned-6b1d

Conversation

@jonyhy96

Copy link
Copy Markdown
Contributor

nerdctl checkpoint rm refused to delete a checkpoint unless the container still existed. The checkpoint directory is keyed only by the checkpoint name, so it stays in the data root after the container is removed and could not be deleted with nerdctl.

When the container lookup finds nothing and the checkpoint directory is still present, the command now deletes that directory. A missing container and a missing checkpoint still report no such container. A path that exists but is not a directory still returns that error.

Fixes #5282

go test -count=1 ./pkg/cmd/checkpoint/

@AkihiroSuda

Copy link
Copy Markdown
Member

Can we have an integration test too?

checkpoint rm refused to delete the directory unless the container still
existed, so a checkpoint outlived the container and could not be removed.

Fixes containerd#5282

Signed-off-by: jony montana <[email protected]>
@jonyhy96
jonyhy96 force-pushed the cursor/checkpoint-rm-orphaned-6b1d branch from bd465b9 to 52d41c2 Compare October 24, 2026 01:43
@jonyhy96

Copy link
Copy Markdown
Contributor Author

Added an integration case, remove-after-container-gone, in checkpoint_remove_linux_test.go.

It creates a checkpoint, removes the container, then runs checkpoint rm. The command exits 0 and the leftover checkpoint directory is gone. A missing container with no checkpoint directory still reports no such container.

@AkihiroSuda AkihiroSuda added this to the v2.5.0 milestone Nov 15, 2026

@AkihiroSuda AkihiroSuda left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda
AkihiroSuda merged commit 22cd939 into containerd:main Nov 15, 2026
83 of 106 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants