I run command docker system prune
yesterday, it took some time and then my SSH session was disconnected from different reason.
Unfortunately I am getting now:
Error response from daemon: a prune operation is already running
.
Obviously there is a lock and prune command is not running anymore.
Does anybody know how remove the lock without stopping and removing all containers?
EDIT: Created an issue in repo: https://github.com/moby/moby/issues/36447
Restarting docker worked for me.
This issue seems to occur when a container is not-responding to docker.
Here is how I've fixed it:
sudo docker inspect %CONTAINER ID%
inspect
command will not return anything. %CONTAINER ID%
not responding has been identified, find its correponding pid with:
ps -aux | grep %CONTAINER ID%
root 14931 0.0 0.0 7648 428 ? Sl Sep13 0:26 docker-containerd-shim -namespace moby -workdir /var/lib/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/3b0d4cba3f63a71fda99c76f3f777a156056e559fb034da4ed59c0aa340e5669 -address /var/run/docker/containerd/docker-containerd.sock -containerd-binary /usr/bin/docker-containerd -runtime-root /var/run/docker/runtime-runc
kill -9 %PID%
Tip 1: There can be one or many container not responding
Tip 2: In order to avoid down-time, you can scale-up the service corresponding to the container that does not respond with a docker service scale ...
.
(my answer complements dparkar's.)
In my case, it was not stuck, just taking a very long time to complete. It deleted 3500 images once finished!
Working solution from the github issue :
doublemcz commented on Mar 14
I can confirm that prune stuck because of a non-responding container. When I kill the container first by
kill -9 PROCESS_ID
where the process Id I get from ps aux | grep docker-containerd-shim -namespace moby -workdir /var/lib/docker/containerd/daemon/io.containerd.runtime.v1.linux/moby/CONTAINER_ID
The problem is that you need to know that there is a container that does not respond on docker :-/ The container works (i.e. node.js works fine) but just docker is not able to even inspect it.
Btw this container should not even be there because we run docker service update... with the :latest image. Docker created another container and this was not killed. So there were two running containers with two different versions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With