3 ms·
You should optimize your RUN commands. Every time you RUN in a Dockerfile, it creates a new filesystem layer. There's a hard limit (42, iirc) to the number of l
by SeoxyS 13y ago
You should optimize your RUN commands. Every time you RUN in a Dockerfile, it creates a new filesystem layer. There's a hard limit (42, iirc) to the number of layers that Docker can support.
Instead of doing:
RUN echo bar >> foo
RUN echo baz >> foo
You could do:
RUN echo bar >> foo \
echo baz >> foo
- jhspaybar 13y agoThis limit is now higher(somewhere in the range of 100), and will eventually go away. Once this limit is gone, best practices will almost surely be one command per run.
- jafaku 13y ago> Once this limit is gone, best practices will almost surely be one command per run. Agreed, I thought the same, but then I hit the 127 (I think) limit.
- 1331 13y agoIn my humble opinion, each layer should have a clear purpose: http://www.extellisys.com/articles/docker-layer-overload http://www.extellisys.com/articles/docker-layer-overload
- shykes 13y agoYou make good points in this post. We are working on addressing some of them already. I would love to discuss this directly, you can ping me anytime, shykes on #docker / freenode.