Last active
February 5, 2020 18:25
-
-
Save amoilanen/b249662513e1a90da5b6b4b682c5854b to your computer and use it in GitHub Desktop.
Useful commands to free Docker space
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Stop and remove all containers | |
docker rm -f $(docker ps -a -q) | |
# Remove all images | |
docker rmi $(docker images -a -q) | |
# Remove other unused docker data, i.e. networks | |
docker system prune | |
# Remove all the unused docker volumes (frees lots of space!) | |
docker system prune --volumes | |
# How to remove stuck Docker volumes in case Docker files in /tmp were accidentally deleted | |
# https://github.com/moby/moby/issues/3894 | |
# If needed remove the BTRFS volumes | |
cd /var/lib/docker/btrfs | |
for f in * | |
do | |
btrfs subvolume delete $f | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment