Skip to content

Instantly share code, notes, and snippets.

@bolavefasfas
Forked from ilagnev/docker-gc.sh
Created August 27, 2022 00:12
Show Gist options
  • Save bolavefasfas/a2d9b75a2eecf9d50957194d2c36c4a3 to your computer and use it in GitHub Desktop.
Save bolavefasfas/a2d9b75a2eecf9d50957194d2c36c4a3 to your computer and use it in GitHub Desktop.
docker clean up stopped containers and remove unlinked images
#!/usr/bin/sh
# info
docker system df # Show docker disk usage, including space reclaimable by pruning
# automatic clean up
docker system prune # will delete ALL unused data
# (i.e. In order: containers stopped, volumes without containers and images with no containers)
# manual clean up
docker container prune # Remove all stopped containers
docker volume prune # Remove all unused volumes
docker image prune # Remove unused images
docker system prune # All of the above, in this order: containers, volumes, images
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment