Skip to content

Instantly share code, notes, and snippets.

Avatar

Francisco Ruiz franciscoruiz

View GitHub Profile
@franciscoruiz
franciscoruiz / docker-rm-in-status.sh
Created Nov 24, 2017
Utility to remove all containers in certain status
View docker-rm-in-status.sh
# docker-rm-in-status (exited|created|running)
docker-rm-in-status ()
{
local status="${1:-exited}";
matching_containers=$(docker ps -aq --filter status="${status}");
if [[ -z "${matching_containers}" ]]; then
echo "No matching containers";
else
echo "Removing containers";
docker rm --volumes --force ${matching_containers};
You can’t perform that action at this time.