16

I am trying to pull the latest official Java docker image (java:8), but I keep getting a failed to register layer error. The Java 7 and 9 docker images download successfully. I am running OS X El Capitan version 10.11.1.

> docker -v
Docker version 1.10.0, build 590d5108
> docker-machine -v
docker-machine version 0.6.0, build e27fb87
> docker pull java:8
8: Pulling from library/java
03e1855d4f31: Extracting [==================================================>] 51.36 MB/51.36 MB
a3ed95caeb02: Download complete 
9269ba3950bb: Download complete 
6ecee6444751: Download complete 
5b865d39f77d: Download complete 
e7e5c0273866: Download complete 
6a4effbc4451: Download complete 
4b6cb08bb4bc: Download complete 
7b07ad270e2c: Download complete 
failed to register layer: rename /mnt/sda1/var/lib/docker/image/aufs/layerdb/tmp/layer-273420626 /mnt/sda1/var/lib/docker/image/aufs/layerdb/sha256/78dbfa5b7cbc2bd94ccbdba52e71be39b359ed7eac43972891b136334f5ce181: directory not empty

Has anyone run across a similar error and successfully resolved it? Thanks

1
  • Had the same issue after a docker update. Stopping the daemon, removing /var/lib/docker (will delete all you volumes, images etc.) and then starting the deamon again solved the issue.
    – leonp5
    Feb 3 at 14:18

1 Answer 1

23

Sometimes docker messes up its workspace, probably that's the cause. You can try these:

  • stop all (java) containers, remove them, delete the java image (or all images), then re-pull and run.
  • if this doesn't help, then restart the docker engine too.
  • if even this doesn't solve the problem, stop the docker engine, delete the docker working directory, then restart docker engine.

In my experience, this solves all similar issues like OP.

3
  • 2
    Thanks @C-Shark, I tried the following and the pull worked this time: - stopped and deleted all containers/images - stopped and deleted the docker machine (docker-machine stop/rm default) - recreated the docker machine (docker-machine create --driver virtualbox default) - docker pull java:8 Feb 10, 2016 at 20:51
  • 3
    In my case, I tried all of the above but the only thing that worked in the end was to stop the docker daemon and delete /var/lib/docker. Upon restart, the docker daemon will re-create /var/lib/docker in a new state.
    – Gary
    Jul 6, 2016 at 15:52
  • it is due to imcomplete download, you may just delete the directory as it complains. This can avoid to re-create the docker directory
    – Larry Cai
    Aug 8, 2016 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.