kind cluster is not deleting, how to fix that?

I am trying to delete kind cluster using.

kind delete cluster --name samples

And I got error after waiting for 15 min.

Deleting cluster "samples" ...
ERROR: failed to delete cluster "samples": failed to delete nodes: command "docker rm -f -v samples-control-plane" failed with error: exit status 1
Command Output: Error response from daemon: removal of container samples-control-plane is already in progress

But this is the only command I ran to delete, not before.

So tried to delete the container of kind cluster using.

docker ps

CONTAINER ID   IMAGE                  COMMAND                  CREATED          STATUS          PORTS
  NAMES
5d0fa7222662   postgres:latest        "docker-entrypoint.s…"   51 minutes ago   Up 51 minutes   0.0.0.0:5432->5432/tcp, :::5432->5432/tcp   postgres_database
e6acb3781680   kindest/node:v1.21.1   "/usr/local/bin/entr…"   33 hours ago     Up 2 hours      127.0.0.1:44151->6443/tcp
  samples-control-plane

And tried deleting stopping it first.

docker stop e6

But stuck there for almost an hour but no response till now.

So I pressed ctrl+c and ran the command with -t.

docker stop e6 -t 2

Same result, stuck there and kept for 3 hours and more, but still there only. How to delete this?


The problem you described most likely has to do with the docker bug. There are many threads on github related to this situation:

  • Failed to delete cluster:

that looks like a docker bug, there was at least one previous bug like this where containers would get in a partially removed state and the only fix was manually removing them w/o docker. looking for current issues upstream.

  • Running kind delete cluster has issue deleting linked containers:

Potentally fiexed in this topic.

  • Removal In Progress:

Hm, I don't think this is a docker-compose issue. However, the way I would proceed is

  1. Stop the docker daemon (sudo service docker stop)
  2. Remove the remaining container files sudo rm -rf /var/lib/docker/containers/9adaaacc30d3<TAB>
  3. Start the docker daemon (sudo service docker start).

Solution / workaround:

Try to restart the docker daemon and do a docker system prune -a.