重启docker服务器后 遇到 'device or resource busy'错误

如果有container在运行的时候重启 docker 服务, 可能会导致 container无法启动, 错误信息类似于 
 

Error response from daemon: Cannot start container zookeeper: Error getting container ddf1dd91bbf46dc648268327f8f7c6fffaf2f19cda5cf1d97fdc701016d4332c from driver devicemapper: Error mounting '/dev/mapper/docker-8:1-525372-ddf1dd91bbf46dc648268327f8f7c6fffaf2f19cda5cf1d97fdc701016d4332c' on '/var/lib/docker/devicemapper/mnt/ddf1dd91bbf46dc648268327f8f7c6fffaf2f19cda5cf1d97fdc701016d4332c': device or resource busy
2015/01/26 04:42:07 Error: failed to start one or more containers

或者

d2859bd1f84b: Error pulling image (latest) from xxxxxx, Driver devicemapper failed to create image rootfs e6158e7962db43274de40fc3db65ad64811d43fe342dea633df20639f5a4e3cd: device e6158e7962db43274de40fc3db65ad64811d43fe342dea633df20639f5a4e3cd already exists 43fe342dea633df20639f5a4e3cd already exists c049b2b: Download complete
e6158e7962db: Error downloading dependent layers


这是一个docker的 bug 


解决方式是先找出没有umount的路径

cat /proc/mounts | grep "mapper/docker" | awk '{print $2}'


然后依次unmount


你可能感兴趣的:(docker)