7

I only have containerd installed, I'm using it for my k8s container runtime. I'm trying to clean up things. What might be the equivalent of the ff docker commands in containerd:

sudo docker rm -vf $(docker ps -a -q)
sudo docker rmi -f $(docker images -a -q)

1 Answer 1

10

To delete images:

ctr -n k8s.io i rm $(ctr -n k8s.io i ls -q | grep your_filter)

The arguments mean:

  • -n: namespace
  • i: image
  • ls: list
  • -q: show only ref

A similar command works for containers:

ctr -n k8s.io c rm $(ctr -n k8s.io c ls -q | grep your_filter)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.