by gavinray · 4y ago · 0 comments
https://docs.docker.com/engine/reference/commandline/build/#...
The downside of trying to jam all of your commands into a gigantic single RUN invocation is that if it isn't correct/you need to troubleshoot it, you can wind up waiting 10-20 minutes between each single line change just waiting for your build to finish.
You lose all the layer caching benefits and it has to re-do the entire build.
Just a heads up for anyone that's not suffered through this before.
I’m confused why they haven’t implemented a COMMIT instruction.
It’s so common to have people chain “command && command && command && command” to group things into a single layer. Surely it would be better to put something like “AUTOCOMMIT off” at the start of the Dockerfile and then “COMMIT” whenever you want to explicitly close the current layer. It seems much simpler than everybody hacking around it with shell side-effects.
> "--squash" is only supported on a Docker daemon with experimental features enabled
Up til now, our biggest improvement was with "FROM SCRATCH".
> Others should note it's still experimental and your build command may fail with
You might try "docker buildx build", to use the BuildKit client -- squash isn't experimental in that one I believe =)https://docs.docker.com/engine/reference/commandline/buildx_...