-
-
Save jihogrammer/f3ca245be4b141b4f9880c03ed49574f to your computer and use it in GitHub Desktop.
Remove all from Docker
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Stop all containers | |
| docker stop `docker ps -qa` | |
| # Remove all containers | |
| docker rm `docker ps -qa` | |
| # Remove all images | |
| docker rmi -f `docker images -qa ` | |
| # Remove all volumes | |
| docker volume rm $(docker volume ls -qf) | |
| # Remove all networks | |
| docker network rm `docker network ls -q` | |
| # Your installation should now be all fresh and clean. | |
| # The following commands should not output any items: | |
| # docker ps -a | |
| # docker images -a | |
| # docker volume ls | |
| # The following command show only show the default networks: | |
| # docker network ls | |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
docker stop `docker ps -qa`이와 같은 명령어를 Windows OS에서 사용 시 주의해야 한다.
Windows의
Commad(cmd)와PowerShell에서는 동작하지 않는다.정확한 원인은 모르겠지만 backtick으로 둘러 싼 부분의 실행 결과를
rm명령어의 args로 넘겨주는 방식으로 동작하는데,아마 cmd나 powershell이 자체적으로 args를 생성하는 방법에서 docker와 충돌이 생기는 듯하다.
대안으로는
Git Bash가 있다. 기타 다른 Terminal은 사용해 본 적이 없어서 잘 모르겠다.