Skip to content

Instantly share code, notes, and snippets.

@matinrco
Created April 29, 2019 12:45
Show Gist options
  • Save matinrco/6886dbafeed95eedfd6cfc7c6b0cf147 to your computer and use it in GitHub Desktop.
Save matinrco/6886dbafeed95eedfd6cfc7c6b0cf147 to your computer and use it in GitHub Desktop.
Update all docker images then remove all untagged images
#!/bin/zsh
####################################################
## Notice : use for development environment only. ##
####################################################
#Update all images
docker images --format "{{.Repository}}:{{.Tag}}" | grep -v "<none>" | xargs -L1 docker pull
#Remove all untagged images
docker rmi $(docker images | grep "<none>" | awk '{print $3}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment