简体   繁体   中英

Docker delete all images script not working on Ubuntu

I need your help with a command I was using on Windows but on Ubuntu it won't work for me.

docker images | grep none | awk ' { print $3; } ' | xargs docker rmi -f & cls & docker images

With this command I get:

-bash: syntax error near unexpected token `}' as error.
cls is an alias I'm using and it's working`

Okay so I got it working with:

docker images | grep none | awk " { print $3; } " | xargs docker rmi -f ; clear ; docker images

Thanks for your efforts tho, it helped me with other problems :)

If I understand correctly what you want to achieve is to delete all dangling images (images not currently used with as both REPOSITORY and TAG). Then you want to clear the terminal and to get a new list of docker images.

If gets you right the following may be found useful by you:

sudo docker image prune -a -f && clear && sudo docker images

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM