Closed
Bug 1316519
Opened 8 years ago
Closed 8 years ago
squash docker image layers in image_builder
Categories
(Taskcluster Graveyard :: Docker Images, defect)
Taskcluster Graveyard
Docker Images
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: jonasfj, Unassigned)
References
Details
Attachments
(1 file)
There is a few decent tools to do this: https://github.com/goldmann/docker-squash https://github.com/jwilder/docker-squash It might be that the tooling isn't stable enough yet, in which case we should just drop the idea. Future versions of docker will likely make it easier to squash images. So porting a newer version to dind-service is another approach to this.
Comment 1•8 years ago
|
||
Presumably we only produce a single image layer during our image build process because we build with the equivalent of `docker build --rm`. That means other layers must come from base images we pull from Docker Registry. One solution might be to squash the base images we use into a single tarball/layer and use those as the base. That will get us down to a single base layer and a layer for our stuff. 2 layers feels pretty manageable. As an added bonus, if we host our own base layers, we'll have better determinism and reproducibility (pulling images without specifying the hash isn't deterministic).
Comment 2•8 years ago
|
||
FWIW, one of the benefits of the "layer tarballs" is they contain metadata such as which command to run as startup. Since we're providing our own metadata and essentially using the images as filesystem snapshots, we can likely throw away the metadata+layers bits.
Comment 3•8 years ago
|
||
This is set for the 1.13 milestone fwiw https://github.com/docker/docker/pull/22641
Reporter | ||
Comment 4•8 years ago
|
||
@gps, No, each RUN command in the Dockerfile produces a file-system layer. Docker build does this so it can cache every build step and quickly rebuild. Given that docker builds are non-deterministic this doesn't always work too well in practice.
Comment hidden (mozreview-request) |
Reporter | ||
Updated•8 years ago
|
Assignee: nobody → jopsen
Status: NEW → ASSIGNED
Reporter | ||
Comment 6•8 years ago
|
||
@dustin, If you r+ I'll build and push the docker image.
Reporter | ||
Comment 7•8 years ago
|
||
note: on the 500mb lint image (which is 200mb after zstd) this saved about 12mb (after zstd). But ideally we get some runtime wins by having fewer layers.
Comment 8•8 years ago
|
||
If 2 images share the same base layer, presumably when we import that image the import of an existing layer is a no-op. While we'd incur time to download and decompress the image, Docker wouldn't process it. Is this true? And if so, does squashing layers undo that optimization?
Comment 9•8 years ago
|
||
mozreview-review |
Comment on attachment 8809979 [details] Bug 1316519 - Squash docker image layers. https://reviewboard.mozilla.org/r/92458/#review92580 The patch looks good. I'm not totally convinced of the wisdom of this -- I think we achieve a very similar effect by using system-setup.sh, meaning that the layers in the final image are largely orthogonal (upstream base, then an image with our system-setup, with a few intervening "0-byte" layers). :gps raises a good point, and anyway I'd be interested to know if this shaves more than ~10mb off desktop-test or desktop-build.
Attachment #8809979 -
Flags: review?(dustin) → review+
Reporter | ||
Comment 10•8 years ago
|
||
> Docker wouldn't process it. Is this true?
Hmm, I don't know...
Anyways, points.
I'll test it with desktop1604-test and see what this gives us.
Reporter | ||
Comment 11•8 years ago
|
||
After testing it some more it seems that docker-squash takes forever on large images (3.5 GB). I tried a different squash utility, but it provided no worthwhile size difference, load time also seemed to be the same. Given these results, I suggest we park this for now and reconsider it when docker adds official support for squashing when building images.
Assignee: jopsen → nobody
Status: ASSIGNED → NEW
Reporter | ||
Comment 12•8 years ago
|
||
mozreview-review |
Comment on attachment 8809979 [details] Bug 1316519 - Squash docker image layers. https://reviewboard.mozilla.org/r/92458/#review93634 After testing with the desktop1604-test image it seems that a 3.5GB image layer causes problems for docker-squash which is written in python. Furthermore, after trying it with different squash utility the win seemed to be negligible. Further investigation needed, but this probably isn't worth trying out before docker comes with built-in squash on-build features.
Attachment #8809979 -
Flags: review-
Updated•8 years ago
|
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Updated•6 years ago
|
Product: Taskcluster → Taskcluster Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•