Skip to content

Instantly share code, notes, and snippets.

@doppiomacchiatto
Forked from GnsP/docker-clean.sh
Created March 20, 2020 19:42
Show Gist options
  • Select an option

  • Save doppiomacchiatto/0216a606ae8e89bb3ef92826b30aae6d to your computer and use it in GitHub Desktop.

Select an option

Save doppiomacchiatto/0216a606ae8e89bb3ef92826b30aae6d to your computer and use it in GitHub Desktop.
Clean docker space for mac osx
#!/bin/bash
# remove exited containers:
docker ps --filter status=dead --filter status=exited -aq | xargs docker rm -v
# remove unused images:
docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs docker rmi
# remove unused volumes:
docker volume ls -qf dangling=true | xargs docker volume rm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment