Docker dangling image remove

yelran
Jan 23, 2021
  • Docker를 Build시, 기존 Image가 있으면 <none>이라고 하는 dangling imager가 발생한다.

Linux 계열의 OS에서는 다음의 명령어가 작동하는데,

docker rmi -f $(docker images -f “dangling=true” -q)
unknown shorthand flag: ‘q’ in -q)
See ‘docker rmi — help’.

Windows에서는 작동하지 않는다.

  • 찾아보니 Docker 1.25이상 버전에서 자체 명령어를 제공한다.
docker image prune
WARNING! This will remove all dangling images.
Are you sure you want to continue? [y/N] y
Deleted Images:
deleted: sha256:a6be4825090befa0bf485b55ca6bde477f39d5fc4c54702e0249ebd4db45de50
deleted: sha256:fad9b6a6d37b41b7406033d07145f8c5a1217554fb601c64622a7282c5d5b1a0
deleted: sha256:7bd00609139e87eab7e61225665844d829b00dfe8ccfae11d6586ea1f69725b8
Total reclaimed space: 590.8MB
  • a 를 붙이면(docker image prune -a) 전체 이미지가 삭제되니 조심하자!

--

--