Docker Nuke
Sometimes I want to rebuild my docker images or containers and start from scratch.
The following alias will just do that:
~/.config/fish/config.fish
bash
alias stop_docker_containers "docker stop (docker ps -a -q)"
alias remove_docker_containers "docker rm (docker ps -a -q)"
alias delete_docker_images "docker rmi -f (docker images -a -q)"
alias delete_docker_volumes "docker volume rm -f (docker volume ls -q)"
alias docker_prune "docker system prune -a"
function docker_nuke
stop_docker_containers
remove_docker_containers
delete_docker_images
delete_docker_volumes
docker_prune
end
I use Fish but you should be able to convert it to your shell of choice.