When working with Docker, the faster we can build an image, the quicker our development workflows and deployment pipelines can be. Docker's build c...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks, Kyle! Re. having 2 consecutive layers, one downloading the file, one removing it - will the final image have that intermediary layer in it (with the file), or will that have no file at all as a result of the last layer only? In other words, will the final image have intermediary layer contents or does it only care about the final layer results?
Great question! A Docker image is really a series of layers all stacked on top of one another. There is an exception there with multi-stage builds, but I'll come back to that.
In the example you're referring to, yes there will be an intermediate layer in the image that contains that file. Now if you SSH into the image, will you find the file? No, as the last layer is your entry layer. But that intermediate layer does exist in the image as a whole and thus contributed to the overall size.
Multi-stage builds, i.e. using multiple
FROMstatements, is like building multiple images concurrently and then in your last stage you copy in files from the other images and that becomes your entire final image. The earlier stages, the otherFROMsteps, are thrown away and don't contribute to the final image or its size.Multi-stage is the best I reduced soo much junk and got a concise image in the end xD
Hi Kyle, thanks for the write-up. We've gone to doing something like this at work because our images for our angular app has gotten way too slow to build.
I'd love to learn more about that!
good