docker常见问题修复方法(不定期更新,加关注不掉队)
运行容器报错:Error response from daemon: Error running DeviceCreate (createSnapDevice) dm_task_run failedmetadata目录在 docker info查看service docker stopthin_check /var/lib/docker/devicemapper/devicemappe...
·
一、运行容器报错:Error response from daemon: Error running DeviceCreate (createSnapDevice) dm_task_run failed
metadata目录在
docker info
查看
service docker stop
thin_check /var/lib/docker/devicemapper/devicemapper/metadata
thin_check --clear-needs-check-flag /var/lib/docker/devicemapper/devicemapper/metadata
service docker start
二、Error running DeviceCreate (ActivateDevice) dm_task_run failed
重启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}'
然后依次
umount
三、[8] System error: fork/exec /usr/bin/docker: cannot allocate memory问题
The fix for me was to add swapspace. By default my digitalocean droplet didn’t come with any swap!
dd if=/dev/zero of=/root/myswapfile bs=1M count=1024
chmod 600 /root/myswapfile
mkswap -f /root/myswapfile
swapon /root/myswapfile
四、 防火墙变动异常
一般异常为
Error response from daemon: Cannot start container web: iptables failed: iptables -t nat -A DOCKER -p tcp -d 0/0 --dport 32797 -j DNAT --to-destination 172.17.0.30:5000 ! -i docker0: iptables: No chain/target/match by that name.
五、解决办法:重建docker0网络恢复
关闭当前防火墙
service iptables stop
重启docker重新建立防火墙规则
service docker restart
根据需求启停容器
docker restart[stop] 容器号
更多推荐
已为社区贡献1条内容
所有评论(0)