Skip to content

Instantly share code, notes, and snippets.

@julianxhokaxhiu
Last active March 9, 2020 19:16
Show Gist options
  • Save julianxhokaxhiu/362cae24e0798bf950ef to your computer and use it in GitHub Desktop.
Save julianxhokaxhiu/362cae24e0798bf950ef to your computer and use it in GitHub Desktop.
Cleanup docker images and containers on a machine
#!/bin/bash
docker rm -v $(docker ps -a -q -f status=exited)
docker rmi $(docker images -f "dangling=true" -q)
docker run -v /var/run/docker.sock:/var/run/docker.sock -v /var/lib/docker:/var/lib/docker --rm martin/docker-cleanup-volumes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment