-
Star
(140)
You must be signed in to star a gist -
Fork
(28)
You must be signed in to fork a gist
-
-
Save daredude/045910c5a715c02a3d06362830d045b6 to your computer and use it in GitHub Desktop.
@echo off | |
FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm %%i | |
FOR /f "tokens=*" %%i IN ('docker images --format "{{.ID}}"') DO docker rmi %%i |
Powershell delete images
docker images -aq | foreach {docker rmi $_}
Thanks!
thank!
Thanks
docker images -aq | foreach {docker rmi -f $_}
Based on @mastroiannim suggestion, I added -f parameter to force image deletion
Thank you!!!
Super, thanks!!
This is pure GOLD. I and the rest of the world :) - THANK YOU !!!!!
docker system prune
worked now
Thanks!
Thanks!
Thanks!
Thanks!
Thanks!
Thank you :-)
Saved me lot of headaches !
docker rm $(docker ps -aq)
Doesn't work here was the result
C:\Users\Administrator>docker rm $(docker ps -aq)
unknown shorthand flag: 'a' in -aq)
See 'docker rm --help'.
pmutua, that doesn't work because it's only valid on Linux or from powershell. You're trying to run it from the Windows command line.
But here are two ways to get it to work:
- you can literally run that command by passing it TO powershell on the DOS cmd line:
powershell "docker rm $(docker ps -aq)"
- or if running powershell at the cmd line strikes anyone as odd, we can do a variant of the longer command originally offered at the top of this gist, but we don't need to do it in a batch file. This would work:
FOR /F %k in ('docker ps -aq') DO docker rm %k
pmutua, that doesn't work because it's only valid on Linux or from powershell. You're trying to run it from the Windows command line.
But here are two ways to get it to work:
- you can literally run that command by passing it TO powershell on the DOS cmd line:
powershell "docker rm $(docker ps -aq)"
- or if running powershell at the cmd line strikes anyone as odd, we can do a variant of the longer command originally offered at the top of this gist, but we don't need to do it in a batch file. This would work:
FOR /F %k in ('docker ps -aq') DO docker rm %k
Thank you
Thanks ! working !
thanks so much
Thank you very much! This bat file has solved vmmem high CPU.
just tried this and it works
foreach ($cnt in $(docker ps -aq)) {docker rm $cnt;Write-Host "$cnt deleted"}
Thx!!!