Skip to content
This repository has been archived by the owner on Oct 18, 2022. It is now read-only.

Squash newly built layers #123

Closed
wants to merge 1 commit into from
Closed

Conversation

tt
Copy link

@tt tt commented Apr 19, 2018

I eagerly prepared this and only afterwards found #90, #119, docker-library/official-images#3383 and docker-library/official-images#3334.

Anyway, this was supposed to propose using the experimental --squash flag introduced in Docker 1.13.0 (see the release notes or moby/moby#22641) when building images. I realize there might be a better solution eventually but perfect is the enemy of good and changing it now doesn't prevent changing it again later.

Rebuilding images from commit 727813e), this is the impact on size:

Size without --squash Size with --squash
14.04 223 MB 183 MB
16.04 112 MB ~86 MB
18.04 79 MB ~69 MB

This shouldn't matter to most registries as they'll hopefully deduplicate content. The desired effect for me is reducing the five layers to a single layer which has a lot of impact when interacting with a registry as each layer causes a series of HTTP requests.

I realize this will properly be closed and that's fine although I would be happy to see it merged even if support is partial.

@yosifkit
Copy link
Collaborator

You are correct in your conclusions about squashing and multistage builds in official images.

As a side note, this would have zero effect on the resulting Docker Hub image since this script is only used for updating the tarballs in git and the Hub images are built via the tools in https://github.com/docker-library/official-images. See https://doi-janky.infosiftr.net/job/multiarch/view/images/view/ubuntu/ for the jobs that finally build and push the images. There is also https://doi-janky.infosiftr.net/job/put-shared/job/heavy/ which pushes the manifest lists so that docker pull ubuntu works correctly for multiple architectures.

@yosifkit yosifkit closed this Apr 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants