oss-fuzz icon indicating copy to clipboard operation
oss-fuzz copied to clipboard

Reduce container images' number of layers

Open kzys opened this issue 3 years ago • 5 comments

https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#env

Each ENV line creates a new intermediate layer, just like RUN commands.

And those layers are not needed for oss-fuzz.

kzys avatar Jun 15 '22 18:06 kzys

I couldn't really find why it's bad to have more layers? Could you explain?

jonathanmetzman avatar Jun 16 '22 00:06 jonathanmetzman

Ping

jonathanmetzman avatar Jul 07 '22 08:07 jonathanmetzman

It is (was?) one of the best practices, recommended by Docker Inc.

https://docs.docker.com/develop/develop-images/dockerfile_best-practices/#minimize-the-number-of-layers

In older versions of Docker, it was important that you minimized the number of layers in your images to ensure they were performant.

But it may be not that relevant anymore, in terms of the runtime performance.

It still affects the container image's total size, since each layer have some metadata.

kzys avatar Jul 07 '22 14:07 kzys

Could you do me a favor and show me what the difference is? If it is negligible I'd rather keep things as is.

jonathanmetzman avatar Jul 07 '22 14:07 jonathanmetzman

Sure. Let me take a look next week.

kzys avatar Jul 08 '22 23:07 kzys

I'm very open to this change, I optimize our docker images a lot because fast (pull) and slim (disk) images make cifuzz/ClusterFuzzLite's UX much better, but I assume you don't have the cycles for this. Please reopen if I'm mistaken and thank you for making this effort.

jonathanmetzman avatar Feb 10 '23 20:02 jonathanmetzman