Forked from beeva-manueldepaz/killAllContainers.sh
Last active
August 20, 2017 19:23
-
-
Save Pelirrojo/162717532e798546bd3734b902ca5e9c to your computer and use it in GitHub Desktop.
Script to stop and delete current running containers (useful to work with DevLab) or even images (commented by default)
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
#!/bin/sh | |
# [DevLab](https://github.com/TechnologyAdvice/DevLab) | |
# $sudo mv /path/to/killAllContainers.sh /usr/local/bin/killAllContainers | |
# $sudo chmod a+x /usr/local/bin/killAllContainers | |
read -p "This will stop and delete all running containers. Are you sure that you want to continue? (y/n) " -n 1 -r | |
echo # (optional) move to a new line | |
if [[ $REPLY =~ ^[Yy]$ ]] | |
then | |
docker stop $(docker ps -a -q) | |
docker rm $(docker ps -a -q) | |
#docker rmi $(docker images -q) | |
#docker rmi $(docker images -q --filter "dangling=true") | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment