dockercontainerscontainerd

How to delete container use containerd ctr?


I use sudo ctr container run ... to run a container. But there are something wrong with the process in my container. So I suppose that there is no task is running. I use sudo ctr task ls, it shows,

TASK         PID    STATUS
test    0      CREATED

Then I want to kill it with sudo ctr task kill test. However, it shows that

ctr: process not started: unknown

Then I use sudo ctr task delete test. It also shows errors,

ctr: task must be stopped before deletion: created: failed precondition

I don't know how to delete this container. Once I delete this container, it comes with ctr: task must be stopped before deletion: created: failed precondition. How can I delete this container?


Solution

  • You can try this way.

    ps aux | grep shim
    sudo kill -9 <pid of your process>