Created
December 17, 2020 22:00
-
-
Save LozanoMatheus/95c3b85910f139b2905c4f1c2888c6dc to your computer and use it in GitHub Desktop.
Cleaning Docker images, networks, volumes, etc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Cleaning Docker images, networks, volumes, etc | |
function flush_docker() { | |
[[ "${1}" == "all" ]] && local delete_docker_volumes="--volumes" | |
docker system df | |
docker rm -f $(docker ps -qa) &> /dev/null | |
Docker_Prune_All="$(docker system prune --all ${delete_docker_volumes} --force)" | |
tail -1 <<< "${Docker_Prune_All}" | |
} | |
## Cleaning Docker except the volumes | |
flush_docker | |
## Cleaning Docker include the volumes | |
flush_docker all |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment