chadoe/docker-cleanup-volumes

Use `find` instead of `ls -d` to avoid `-bash: /bin/ls: Argument list too long`

drags opened this issue · 2 comments

drags commented

First off, thanks for this handy script!

I ran into an issue because my build server had ~85k orphaned volumes (image building server from late 2014 :) ) where the ls -d ${targetdir}/* command was failing.

I was able to replace it with find ${targetdir} -maxdepth 1 -type d and continue on my merry way, however I don't have the time or criteria to test and ensure that works in all cases, so I figured an issue was better than a PR.

Thanks again and hope this helps!

Hey @drags, I ended up having the same issue and sent over pull req #23. Updated to include maxdepth.

drags commented

@almonteb awesome! I should have checked PRs first. Thank you for opening #23