mirror of
https://github.com/nmasur/dotfiles
synced 2024-11-10 02:52:55 +00:00
script cleaning for docker_cleanup
This commit is contained in:
parent
d2ab01ee15
commit
bd0bf927e1
@ -3,7 +3,7 @@
|
|||||||
# Stop all containers
|
# Stop all containers
|
||||||
if [ "$(docker ps -a -q)" ]; then
|
if [ "$(docker ps -a -q)" ]; then
|
||||||
echo "Stopping docker containers..."
|
echo "Stopping docker containers..."
|
||||||
docker stop $(docker ps -a -q)
|
docker stop "$(docker ps -a -q)"
|
||||||
else
|
else
|
||||||
echo "No running docker containers."
|
echo "No running docker containers."
|
||||||
fi
|
fi
|
||||||
@ -11,14 +11,14 @@ fi
|
|||||||
# Remove all stopped containers
|
# Remove all stopped containers
|
||||||
if [ "$(docker ps -a -q)" ]; then
|
if [ "$(docker ps -a -q)" ]; then
|
||||||
echo "Removing docker containers..."
|
echo "Removing docker containers..."
|
||||||
docker rm $(docker ps -a -q)
|
docker rm "$(docker ps -a -q)"
|
||||||
else
|
else
|
||||||
echo "No stopped docker containers."
|
echo "No stopped docker containers."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove all untagged images
|
# Remove all untagged images
|
||||||
if [[ $(docker images | grep "^<none>") ]]; then
|
if [[ $(docker images | grep "^<none>") ]]; then
|
||||||
docker rmi $(docker images | rg "^<none>" | awk '{print $3}')
|
docker rmi "$(docker images | grep "^<none>" | awk '{print $3}')"
|
||||||
else
|
else
|
||||||
echo "No untagged docker images."
|
echo "No untagged docker images."
|
||||||
fi
|
fi
|
||||||
|
Loading…
Reference in New Issue
Block a user