One huge pain point I have when authoring Dockerfile is flattening of images. The large number of snapshots is great in Dev but slows down production setups.
Has there been any discussion about an extension such as this to Dockerfile format.
Dockerfile
CHECKPOINT EXPLICIT
RUN some_command
RUN some_command
RUN some_command
RUN some_command
CHECKPOINT
RUN some_command
RUN some_command
RUN some_command
For example this would generate 2 images.
It would be a blessing in dev as you could just comment out the CHECKPOINT EXPLICIT line, so no need of hacky Dockerfiles.
yes, there was a PR, and iirc it was rejected for a few reasons (I cna’t
find the PR itself atm)
There is another one atm for a docker squash baseimage image command,
that would allow you to do something similar after the fact, (i realise its
not quite the same thing)
You can do this using multiple from directives. As an example…
from ubuntu
run echo hello, world
from ubuntu
touch /hello
generates two images.
That said, you probably are thinking of having the second from inherit the environment from the second. Right now the best way to do that is by chaining volumes from one container to another, and using the run directive to store in to there.
Let me know if you need an example of that as well - I take this to the extreme on a beta blog implementation