Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Docker trouble with too many link

Tags:

docker

build

During a docker build, i have this error :

Step 1 : FROM million12/nginx-php:latest
 ---> 09c053597dda
Step 2 : COPY etc/docker-jenkins/default.conf /etc/nginx/hosts.d/default.conf
 ---> Using cache
 ---> 26a29dd01af3
Step 3 : COPY app /data/www/app
INFO[0012] link /var/lib/docker/overlay/99380f87e1572466529c4f668b5e79fe711496e9
85d313cc0d2f45bfdbdb3969/root/var/lib/yum/yumdb/p/939d2078d64d51ff7ad16150745e94
a26085bc93-php70-php-opcache-7.0.11-1.el7.remi-x86_64/checksum_type /var/lib/doc
ker/overlay/9ac18f869f20ba8ba29d2a16f00f2ce6ff1c6d0d1a40192a0efb8933c8ad1c45/tmp
root958106287/var/lib/yum/yumdb/p/939d2078d64d51ff7ad16150745e94a26085bc93-php70
-php-opcache-7.0.11-1.el7.remi-x86_64/checksum_type: too many links

Someone has an idea to fix this ? Inside the app directory there are not many file or directory and not that long. I'm on a ext4 fs on a ubuntu 16.04 Thank you :)

like image 731
PBrun Avatar asked Dec 27 '16 15:12

PBrun


People also ask

Can we have multiple Workdir in Dockerfile?

You can have multiple WORKDIR instructions in your Dockerfile. If you use relative paths as Working Directory, it will be relative to the previous Working Directory. The default path is /

Why is Docker image size too big?

With Docker, it's very easy to unknowingly bloat your image. Every command creates a new layer, and all layers are saved separately. Therefore, if a big file is generated by one command and removed later in the Dockerfile, it will still add bloat to the size.

What does -- Link do in Docker?

The --link flag is a legacy feature of Docker. It may eventually be removed. Unless you absolutely need to continue using it, we recommend that you use user-defined networks to facilitate communication between two containers instead of using --link .


2 Answers

I also had the same problem but it was because of another reason. If you use overlayfs as your storage driver (see with docker info | grep 'Storage Driver') you will get the 'too many links' really soon because it uses hardlinks for making the layers and it has a limitation on how many it can have. So the solution is to change to another, normally overlayfs2 (made to solve that).

like image 60
Minguez Avatar answered Nov 05 '22 04:11

Minguez


Though this question is now very old, but want to add my point.

This issue can occur when there are too many dangling images in your system. You should clear them time to time or you can create a scheduler to run time to time to clear these dangling images.

Try this to remove dangling images:

sudo docker rmi -f $(docker images -q --filter dangling=true)

or

docker system prune

Please refer this to know more on dangling images Click here

like image 32
Aditya Dwivedi Avatar answered Nov 05 '22 02:11

Aditya Dwivedi