Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Deleting docker images manually

Tags:

docker

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?

like image 400
shayy Avatar asked Apr 16 '15 11:04

shayy


People also ask

Is it safe to delete docker 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.

Can not delete docker images?

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.


1 Answers

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.

like image 71
shayy Avatar answered Oct 03 '22 06:10

shayy