Hacker News new | ask | show | jobs
by SeoxyS 4446 days 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
2 comments

In my humble opinion, each layer should have a clear purpose: http://www.extellisys.com/articles/docker-layer-overload
You 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.
This 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.
> 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.