There's no way to flatten images right now. When performing a build in multiple steps, a few images can be generated and a larger number of layers is produced. When these are pushed to the registry, a lot of data and a large number of layers have to be downloaded.
There are some cases where one starts with a base image (or another image), changes some large files in one step, changes them again in the next and deletes them in the end. This means those files would be stored in 2 separate layers and deleted by whiteout files in the final image.
These intermediary layers aren't necessarily useful to others or to the final deployment system.
Image flattening should work like this:
- the history of the build steps needs to be preserved
- the flattening can be done up to a target image (for example, up to a base image)
- the flattening should also be allowed to be done completely (as if exporting the image)
There's no way to flatten images right now. When performing a build in multiple steps, a few images can be generated and a larger number of layers is produced. When these are pushed to the registry, a lot of data and a large number of layers have to be downloaded.
There are some cases where one starts with a base image (or another image), changes some large files in one step, changes them again in the next and deletes them in the end. This means those files would be stored in 2 separate layers and deleted by whiteout files in the final image.
These intermediary layers aren't necessarily useful to others or to the final deployment system.
Image flattening should work like this: