Skip to content

Instantly share code, notes, and snippets.

@dvdrhr
Last active February 23, 2017 12:43
Show Gist options
  • Save dvdrhr/921bd0bf897cd9d5a7cdf0f1c063ad87 to your computer and use it in GitHub Desktop.
Save dvdrhr/921bd0bf897cd9d5a7cdf0f1c063ad87 to your computer and use it in GitHub Desktop.
Docker CLI commands
# remove all exited containers
docker rm $(docker ps --all -q -f status=exited)
# remove all dangling (not used by any created container) images
docker rmi $(docker images -f "dangling=true" -q)
# remove all images with name (with or without wildcards)
docker rmi -f $(docker images | grep "docker-reg.host.com/imagename.or.partofimagename.*" | awk "{print $3}")
# run docker registry garbage collection
docker exec -it registry bin/registry garbage-collect /etc/docker/registry/config.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment