At different places I found the information that a docker image can only consist of up to 42 layers. This seems to be a limitation of the used AUFS file system.
Can anybody tell me why this limit exists or does anybody have some documentation explaining this?
This seems to be imposed primarily by AUFS (
sfjro/aufs4-linux
).See PR 50 "Prohibit more than 42 layers in the core "
PR 66 was supposed to remove that limit
This thread reported:
From the Docker BP documentation:
They also give advices on how to avoid too many layers:
TL;DR: the benefit of minimizing the number of layers can be likened to the benefit of minimizing the number of small files but rather have fewer bigger ones. A
docker pull
is also faster (try downloading 2048 files of 1kB or one file of 2MB) . and having fewer layers reduces the complexity of an image, hence the maintainability.As for the
42
limit. Well... I guess they had to come up with a number and they pick this particular one ;)