I have about 50K of images in my local ubuntu:
$ docker info
Containers: 3
Images: 49708
Storage Driver: aufs
Root Dir: /var/lib/docker/aufs
Backing Filesystem: extfs
Dirs: 49714
docker rmi -f $(docker images | grep "something" | awk "{print \$3}")
Takes 100% CPU and is too slow. Is there any fast way to delete a bulk of images?
In any case, deleting an image usually presents no issue—if you need it again, Docker can just fetch it from the remote repository.
In short, Docker error unable to delete image must be forced occur if some containers are running on it. If it is a stopped container we forcefully remove it. If not we stop and remove the container and delete the image.
So Answering my own question, there is a script in docker contrib directory: https://github.com/docker/docker/blob/620339f166984540f15aadef2348646eee9a5b42/contrib/nuke-graph-directory.sh
Running it with sudo deleted all my images, just restart docker daemon and you are good to go.
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