3 ms·
I suggest reading about multi-stage builds. They basically squash layers at the end so it's a "have cake and eat it too" scenario. This pattern of concatenatin
by Leace 7y ago
I suggest reading about multi-stage builds. They basically squash layers at the end so it's a "have cake and eat it too" scenario.
This pattern of concatenating commands to have a minimal image is a workaround from times when multi-stage builds were not available.
- annymsMthd 7y agoMultistage builds do not squash at the end.
- chatmasta 7y agoYou can do this with experimental flags [0] and --squash [1] [2] [0] https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/experimental.md https://github.com/moby/buildkit/blob/master/frontend/docker... [1] https://geraldonit.com/2017/11/13/how-to-create-small-docker-images/ https://geraldonit.com/2017/11/13/how-to-create-small-docker... [2] https://docs.docker.com/engine/reference/commandline/image_build/ https://docs.docker.com/engine/reference/commandline/image_b...