-
Wow that's very interesting regarding layers... I love real world examples like this! too many time you read blogs, etc saying you 'must always' minimize the number of layers |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The normal best practice is to minimize the number of layers in a Docker image. I would suggest that a Codespaces image isn't a "normal" use case. By intentionally creating small layers, we reduced the create time by up to 50% due to the parallel pull. |
Beta Was this translation helpful? Give feedback.
-
I realize this may be straying off topic, but anyway: I was the person who wrote the quote in the OP. I've accepted as 'gospel' for years that you need to minimize the number of docker image layers, but your demo yesterday made me question this. Yes, I totally get using multistage builds to minimize image size. But within a single image, what's the actual benefit of minimizing the number of layers? eg, everyone says to do (A):
rather than (B):
but there's little discussion as to WHY. Even Docker handwaves on the topic. Theres a reasonable Q&A on this topic I found on Stack Overflow |
Beta Was this translation helpful? Give feedback.
The normal best practice is to minimize the number of layers in a Docker image.
I would suggest that a Codespaces image isn't a "normal" use case. By intentionally creating small layers, we reduced the create time by up to 50% due to the parallel pull.