Docker Community Forums

Share and learn in the Docker community.

Dockerfile Checkpoints


(Sam Saffron) #1

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.

Thoughts?


(Sven Dowideit) #2

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)

Sven


(Sam Saffron) #3

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?


(Sven Dowideit) #4

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

The pain being in the details :slight_smile:


(Ps) #7

Nonetheless a huge help.

I wonder why this is rejected as a concept? .


(Sven Dowideit) #8

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


(Nick Stinemates) #9

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


(Sam Saffron) #10

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

I still feel this should be baked into docker though.