Created
March 17, 2020 03:41
-
-
Save pungoyal/d235530f9ca4615b52f5c9e4715a02cc to your computer and use it in GitHub Desktop.
This file contains hidden or 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
❯ cat ~/.config/fish/functions/update-docker.fish | |
function update-docker -d "pull latest images from docker" | |
docker ps -a | |
echo 'cleaning dead containers' | |
docker ps -a | sed '1d' | cut -d' ' -f1 | xargs docker rm -f | |
echo 'removing untagged images' | |
docker images -a | sed '1d' | grep none | awk '{print $3}' | xargs docker rmi | |
docker images -a | |
echo 'pulling latest image with tags' | |
docker images -a | sed '1d' | awk '{print $1":"$2}' | xargs -L1 docker pull | |
docker images -a | sed '1d' | grep none | awk '{print $3}' | xargs docker rmi | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment