简体   繁体   English

Docker 删除所有无法在 Ubuntu 上运行的图像脚本

[英]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.我在 Windows 上使用的命令需要您的帮助,但在 Ubuntu 上它对我不起作用。

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.然后你想clear终端并获得一个新的 docker 图像列表。

If gets you right the following may be found useful by you:如果让您正确,您可能会发现以下内容对您有用:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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