Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save grammy-jiang/5e234bc2bb1c01d2ec73882d4ea9079a to your computer and use it in GitHub Desktop.
Save grammy-jiang/5e234bc2bb1c01d2ec73882d4ea9079a to your computer and use it in GitHub Desktop.
Update all docker images & Remove the images with the label '<None>'

Update all docker images and remove dangling ones

Update all images with the 'latest' label

docker images --format "{{.Repository}}:{{.Tag}}" | grep ':latest' | xargs -L1 docker pull

Remove the dangling images

docker rmi $(docker images --quiet --filter "dangling=true")

Remove all exited docker containers

docker rm $(docker ps --all --quiet --filter status=exited)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment