How to prune containerd images and containers?

Viewed 480

What is the docker system prune for containerd? I wanted to delete unused images and stopped containers to free up storage

3 Answers

For now, there's no command to do the same. There is an issue open for nerdctl and it seems that some alternative commands are being implemented.

crictl provides a CLI for CRI-compatible container runtimes.

With crictl we have an option to Remove all unused images similarly to how we used to prune the images using docker cli for docker

Command:

crictl rmi --prune

Since July 2022, nerdctl v0.22.1 do includes:

nerdctl system prune:

Add nerdctl system prune command. Needs --all. (PR 1264, thanks to @junnplus)

And nerdctl image prune (PR 1194) or nerdctl container prune (PR 1180) was added in v0.22.0.

nerdctl system prune

Remove unused data

⚠️ Currently, nerdctl system prune requires --all to be specified.

Usage: nerdctl system prune [OPTIONS]

Flags:

  • -a, --all: Remove all unused images, not just dangling ones
  • -f, --force: Do not prompt for confirmation
  • --volumes: Prune volumes Unimplemented docker system prune flags: --filter
Related