Last active
April 16, 2020 14:20
-
-
Save JonasAlfredsson/8f278acfe8bc13cd866a76cc83de3b40 to your computer and use it in GitHub Desktop.
Useful Docker Functions
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
# Docker Functions | |
# A small collection of commands that can be quite useful when | |
# working with Docker. | |
# Stop all containers on the system. | |
stop_all_containers() { | |
docker stop $(docker ps -aq) | |
} | |
# Stop all containers on the system and remove them. | |
remove_all_containers() { | |
docker stop $(docker ps -aq) | |
docker rm $(docker ps -aq) | |
} | |
# Find, kill and completely remove any and all Docker containers, | |
# images, volumes and networks that might be hiding on your system. | |
docker_armageddon() { | |
remove_all_containers | |
docker network prune -f | |
docker rmi -f $(docker images --filter dangling=true -qa) | |
docker volume rm $(docker volume ls --filter dangling=true -q) | |
docker rmi -f $(docker images -qa) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Code taken from here: https://stackoverflow.com/questions/34658836/docker-is-in-volume-in-use-but-there-arent-any-docker-containers