Recover a docker container which ran out of space with device mapper

When installing docker on a centos/redhat distribution the default copy-on-write file driver is device mapper and the default size for each container is 10Gb. As soon as the container exceeds this, it will crash, and , when trying to start it, you’ll get something like:

Cannot start container myContainer.
System error: can't create pivot_root dir ,
error mkdir /var/lib/docker/devicemapper/<wbr />mnt/<wbr />4039724368a939e508fefaf7f1242e<wbr />94a6000d30c0b75b45c0e5bdf81925<wbr />296a/rootfs/.pivot_<wbr />root575410080: no space left on device

With recent linux versions (centos 7), I was able to recover the container, by following these steps:

  • Save the container as an image, using docker commit
  • Save the new image as a tar file on disk, using docker save
  • Reconfigure the default space per container, as explained in this post
  • In the previous step will loose all local images and containers, but you have saved your image as a tar file on disk.
  • load the image you previousley saved, using docker load
  • run a new container from the just loaded image, using docker run


This entry was posted in docker, linux. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s