Last Updated: September 23, 2016
· trinitronx

Fix Leftover Docker Mounts

I've noticed sometimes Docker tends to leave around mounts from old containers. When you try to remove an old container, sometimes it will complain about a busy resource with an error like this:

docker rm 08e0292e43c87013ff6e71f5d8b5ea90bf0dab84c97a2a3bfd58f8c8cbd93d94
2014/01/27 16:25:01 Error: Cannot destroy container 08e0292e43c87013ff6e71f5d8b5ea90bf0dab84c97a2a3bfd58f8c8cbd93d94: Driver aufs failed to remove root filesystem 08e0292e43c87013ff6e71f5d8b5ea90bf0dab84c97a2a3bfd58f8c8cbd93d94: device or resource busy

To clean ALL of the old mounts up:

umount -l $(grep 'aufs' /proc/mounts | awk '{print$2}' | sort -r)

This is a known bug with docker, and there are currently many open bugs on this: #3786 #2714 #3823