Docker: Recovering from deleting /var/lib/docker

I deleted “/var/lib/docker/” when I was dealing with Docker Thin Pool error below.

devmapper: Thin Pool has 114247 free data blocks which is less than minimum required 116729 free data blocks. Create more free space in thin pool or use dm.min_free_space option to change behavior

However, I couldn’t restart docker and got ea new error:

Resolve Error starting daemon: error initializing graphdriver: devmapper: Unable to take ownership of thin-pool (docker-docker–pool) that already has used data blocks

Recovering from deleting /var/lib/docker

Following solution worked for me.

$ sudo service docker stop
$ sudo lvremove docker

Comment out or remove the DOCKER_STORAGE_OPTIONS in /etc/sysconfig/docker-storage (CentOS) 

$ cat /etc/sysconfig/docker-storage
# DOCKER_STORAGE_OPTIONS="--storage-driver devicemapper --storage-opt dm.fs=xfs --storage-opt dm.thinpooldev=/dev/mapper/vg_docker-docker--pool --storage-opt dm.use_deferred_removal=true "

$ sudo docker-storage-setup
$ sudo service docker start

Leave a Reply

Your email address will not be published. Required fields are marked *