Get input/output error when running docker build

Recently, I always got the the following error to run docker build:

[myname@mymachine Base]$ docker build .
Sending build context to Docker daemon 327.1 MB
Sending build context to Docker daemon
Step 0 : FROM centos:latest
—> 3aa28fd030d9
Step 1 : COPY installer /installer
INFO[0002] mkdir /var/lib/docker/devicemapper/mnt/235fddeae8036f4edd5052d2b7f0dbab955532ec3c99b3e2c992e4f4f1c10739-init/rootfs: input/output error

I searched in the internet, and did not see any valuable comments

A blunt answer to this class of problem is to stop Docker, sudo rm -rf /var/lib/docker, and start it again. You’ll need to re-pull/re-build any local images you had.

(As I noted in another post, you should plan ahead in designing your Dockerfiles and what not so that this is straightforward.)

Thanks very much, Dmaze. Your approach works well up to now.

Hi @stonemind I am getting this error very often, if there a parmanent fix for this?

Hi, Yogesh,

It is difficult for me to access the site now. You can check your disk usage first. If it does not work, please try to remove the docker /var/lib/docker (maybe I used a wrong path/name, it is a directory to save the docker stuff, like the image/containers), and try again.

Thanks

Junger

1 Like

@stonemind Thanks for the reply. The problem was with the disk usage. I saw the disk usages where touching the 100%. So I closed some application and waited for it to go down and then tried and it worked.