Docker building fails randomly with Error mounting

2019-07-20 10:57发布

问题:

Every time I try building with docker or fig an image (doesn't matter which one), I randomly will get

Cannot start container <containerId>: Error getting container <containerId> from driver devicemapper: Error mounting '/dev/mapper/docker-8:1-262151-<containerId>' on '/var/lib/docker/devicemapper/mnt/<containerId>': no such file or directory

Weird thing is, if I re-run it, it usually won't have the same error.

Note that I am running docker inside vagrant (ubuntu-trusty-64)

回答1:

I have seen this many times in docker-1.4.1, especially if you're using a base image built with a previous version of docker. You can try to rebuild your base image with docker-1.4.1, but why I ended up doing with just going back to docker-1.3.3 for now.



回答2:

Switching to aufs storage seemed to resolve it.

I used a base image box from phusion which seems to optimize for docker.



回答3:

This is known bug occuring with devicemapper driver only.

Here is the reference of the bug: https://github.com/docker/docker/issues/4036

Solution is to switch either to aufs or overlayfs drivers.



标签: docker fig