Running the yum cleanup in a separate layer only increases the size of
the image. In order to clean the yum cache and have it reduce the final
image size we must do it in the same layer that populates it.
We should also perform a cache cleanup in each subsequent layer that
performs yum operations.
Image size before this change: 3.3GB
Image size after this change: 2.6GB
Correct implementation of yum cache cleanup
Running the yum cleanup in a separate layer only increases the size of the image. In order to clean the yum cache and have it reduce the final image size we must do it in the same layer that populates it.
We should also perform a cache cleanup in each subsequent layer that performs yum operations.
Image size before this change: 3.3GB Image size after this change: 2.6GB