When things get really messy, I go full throttle and combine everything:
docker rm -f $(docker ps -aq)
docker rmi -f $(docker images -q)
This forcefully deletes all containers and images manually. It’s more aggressive than pruning, but it’s sometimes necessary, especially if something is stuck or prune isn’t catching everything. Just make sure to check with docker ps -a
and docker images
before you do a mass delete!