개발/Docker
Docker 사용하지않는 컨테이너 전체 삭제
심집사
2022. 8. 18. 11:03
Docker
Stop된 Container 한번에 지우기 (일괄삭제)
하나하나 docker rm {container name}
을 하기란 힘들다!
- 방법1: 1.13버전부터 이렇게 공식적으로 명령을 지원한다. (Since Docker 1.13.x you can use Docker container prune:)
docker container prune
- 방법2: 그전에는 이렇게 지웠다.
docker rm $(docker ps -q -f status=exited)
- (보너스) 안쓰는 자원 정리하기
- clean up all unused containers, networks, images (both dangling and unreferenced), and optionally, volumes, in one command.
- docker system prune
Reference - 참고
- How to remove old Docker containers: https://stackoverflow.com/questions/17236796/how-to-remove-old-docker-containers