Error response from daemon: Driver devicemapper failed to remove root filesystem <id>: Device is Busy

Docker 容器删除的时候报错

解决办法:

#!/bin/bash

dockerdir=/var/lib/docker  
device_dir=${dockerdir}/devicemapper/mnt/


container_ids=$(docker ps -a -q --no-trunc)

for container in $container_ids; do  
        name=$(docker inspect -f '{{ .Name }}' $container)
        echo ' '
        echo ' '
        echo '----------------  Docker Container Volumes  --------------------'
        echo 'Container NAMES =' $name
        echo 'Container ID =' $container
        echo 'Umount Container Volumes'

                umount $device_dir/$container

done