I have a lot of space (partition full) in the /var/lib/docker/aufs folder.
I've cleaned my volumes with :
docker volume rm $(docker volume ls -qf dangling=true)
Cleaned images with :
docker rmi $(docker images --filter "dangling=true" -q --no-trunc)
But no effect on the /var/lib/docker/aufs folder.
Any ideas? Thanks
docker volume ls -qf dangling=true lists volumes that aren't currently assigned to a container. There may be volumes that are still in use, so not all volumes will be removed by this command. I personally avoid doing a cleanup with this command since it may remove volumes that aren't currently in use, but have important data that I want to mount into a container later.
docker images --filter "dangling=true" -q --no-trunc lists images that are not tagged. The most likely cause for this is pulling or building a new version of an old image you already had on the local machine. It doesn't cleanup all the images you've pulled or built, still have tagged, but don't use.
Neither of these commands cleanup containers that may be stopped and no longer needed. For that, you'd need to look at docker ps -af status=exited to see what containers aren't running and can be deleted with a docker rm. Scripted, that looks like:
docker rm $(docker ps -aqf status=exited)
With the 1.13 release, you can now run:
docker system prune
which will cleanup everything, or you can be more specific and clean specific pieces like:
docker container prune
docker image prune
docker volume prune
The docker image prune command can take the option -a to also prune all unused images rather than just the dangling ones.