#!/bin/bash
docker_cleanup ()
{
#containers cleanup
docker stop $(docker ps -a -q) -f
docker rm $(docker ps -a -q) -f
#images cleanup
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) -f
docker rmi $(docker images -a -q) -f
#misc cleanup
docker rmi $(docker images -a --filter=dangling=true -q)
docker rm $(docker ps --filter=status=exited --filter=status=created -q)
#prune cleanup
docker image prune -a
docker system prune -a
docker system prune --volumes
docker builder prune
docker volume prune
}
docker_cleanup ()
{
#containers cleanup
docker stop $(docker ps -a -q) -f
docker rm $(docker ps -a -q) -f
#images cleanup
docker rmi $(docker images --filter "dangling=true" -q --no-trunc) -f
docker rmi $(docker images -a -q) -f
#misc cleanup
docker rmi $(docker images -a --filter=dangling=true -q)
docker rm $(docker ps --filter=status=exited --filter=status=created -q)
#prune cleanup
docker image prune -a
docker system prune -a
docker system prune --volumes
docker builder prune
docker volume prune
}