Last Updated: April 20, 2021
·
381
· Misha Behersky

Docker remove all images despite containers using them

docker rmi -f $(docker images -q)

Remove all containers:
docker rm $(docker ps -a -q)

Remove all images without name:
docker rmi $(docker images | grep '^<none>' | awk '{ print $3 }')
Forced removal (even if some container is using it):
docker rmi -f $(docker images | grep '^<none>' | awk '{ print $3 }')

1 Response
Add your response

Try docker rmi $(docker images -f "dangling=true" -q) to remove unnamed images

over 1 year ago ·