Can't run Docker container due device mapper error Can't run Docker container due device mapper error docker docker

Can't run Docker container due device mapper error


The following is for a Fedora/RHEL system, so you'll need to adjust for Debian...

# systemctl stop docker.service# thin_check /var/lib/docker/devicemapper/devicemapper/metadata

If there were no errors then proceed with:

# thin_check --clear-needs-check-flag /var/lib/docker/devicemapper/devicemapper/metadata# systemctl start docker.service# docker run --name=fpm-5.3 debian:jessie

To install thin_check command, run:

# apt-get install -y thin-provisioning-tools


When the docker partition filled and docker would no longer start after reboot, I encountered this:

# thin_check /var/lib/docker/devicemapper/devicemapper/metadataexamining superblockexamining devices tree  missing devices: [0, -]    bad checksum in btree nodeexamining mapping tree  thin device 72 is missing mappings [137494, 137594]    bad checksum in btree node  thin device 72 is missing mappings [137721, -]    bad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree nodebad checksum in btree node

I was able to repair with this procedure:

# thin_dump -r /var/lib/docker/devicemapper/devicemapper/metadata -o /tmp/metadata.xml# thin_restore -i /tmp/metadata.xml -o /var/lib/docker/devicemapper/devicemapper/metadata


In our case just need to start and stop the service.

Depending on your system you can run:

service docker stopservice docker start

or:

sudo systemctl stop docker.servicesudo systemctl start docker.service

or:

sudo /etc/init.d/docker restart