Support Image Flattening Following Build

Registered by Pete Birley

Introduce a mechanism for flattening images built via Kolla:
Kolla images are built using an extensible template system, that allows
complex images for multiple platforms to be created simply: however the docker
build methodology results in images with redundant artifacts in layers that are
then masked by subsequent ones. This results in images that are potentiality
much larger than required; resulting in slower deployment and excessive disc
usage. This blueprint proposes introducing a flattening option to kolla-build
that merges layers in a Dockerfile into a single layer: which addresses the
above issues and frees developers to further optimize Kolla images simply by
removing development tools (e.g. gcc & libs) from images for deployment. This
also addresses the issue created by the AUFS limit of 127 layers per image by
reducing the number of layers present in parent images.

Blueprint information

Status:
Complete
Approver:
None
Priority:
Undefined
Drafter:
Pete Birley
Direction:
Needs approval
Assignee:
Pete Birley
Definition:
New
Series goal:
None
Implementation:
Implemented
Milestone target:
None
Started by
Mark Goddard
Completed by
Mark Goddard

Related branches

Sprints

Whiteboard

A prototype was produced:
https://review.openstack.org/#/c/392115/
* This stresses the docker-engine to the point of crashing on Zuul and my laptop unless run with --threads=1.

Docker have now introduced similar functionality upstream, but this flattens all layers to a single image, rather than the delta between the FROM statement in a Dockerfile to it's end:
https://github.com/docker/docker/commit/362369b4bbea38881402d281ee2015d16e8b10ce

mgoddard: available via the --squash argument.

(?)

Work Items

This blueprint contains Public information 
Everyone can see this information.