Dockerfile Checkpoints

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.


RUN some_command
RUN some_command
RUN some_command
RUN some_command
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)


That’s a slightly different workflow though, also forces an extra step when sharing Dockerfiles.

Nonetheless a huge help.

I wonder why this is rejected as a concept?

I don’t think the concept is rejected, just the implementation suggestions so far

The pain being in the details :slight_smile:

Nonetheless a huge help.

I wonder why this is rejected as a concept? .

It hasn’t been rejected as a concept - but there hasn’t been a satisfactory implementation yet.

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

I am finding @jwilder’s docker squash quite handy in this area.

I still feel this should be baked into docker though.