Skip to content

Commit

Permalink
Merge pull request #7 from for-geeks/seg
Browse files Browse the repository at this point in the history
docker:add docker resources clean scripts
  • Loading branch information
mickeyouyou authored Dec 15, 2019
2 parents e84d0f8 + 5a1e8c4 commit fcdf83a
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions docker/clean_resources.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/usr/bin/env bash

# Usage:
# ./clean_resources.sh

if [ ! -z ${DOCKER_IMG} ]; then
echo "This script is expected to be run on host instead of the container."
echo "Please exit."
exit 1
fi

# Credit to https://stackoverflow.com/questions/38118791/can-t-delete-docker-image-with-dependent-child-images
echo "Cleanup containers..."
docker rm $(docker ps -qa --no-trunc --filter "status=exited")

echo "Cleanup images..."
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)

echo "Cleanup volumes..."
docker volume rm $(docker volume ls -qf dangling=true)

#echo "Cleanup images not used"
# docker rmi geekstyle/geek_lite:geek_pcl

0 comments on commit fcdf83a

Please sign in to comment.