So what is your suggestion about that? Would you rather to have a few or lots of layers in your application's docker image?
For further actions, you may consider blocking this person and/or reporting abuse
So what is your suggestion about that? Would you rather to have a few or lots of layers in your application's docker image?
For further actions, you may consider blocking this person and/or reporting abuse
Suleiman Dibirov -
Mark Phelps -
Ukeme David Eseme -
Lucas Cândido Araújo -
Top comments (2)
The biggest issue (no pun intended) with having more layers is image size. Because of how Docker images work, each layer that changes file contents or adds files adds the total size of all files it adds or modifies to the final image size, even if later layers remove those changes or files.
This doesn't sound very significant, but it can have a huge impact. This is a large part of why adding packages to a base image is almost always done as a single
RUN
line that updates package caches, installs the required packages, and then nukes the caches, as doing each part as it's ownRUN
line can inflate the resultant image size by hundreds of megabytes.There are a couple of other far less significant downsides to having lots of layers:
On the other side of the coin, adding more layers can help you improve build times by allowing you to leverage caching better. However, this can lead to all kinds of issues if you're not careful about dropping the cache when you need to.
I'd say you want the right layers. So as it said, a php installed layer then application. The multiparty docker can be good to limit final image size, but don't use it as a poor man's build system.