Let\'s take the whalesay images as an example. docker history
shows the following:
IMAGE CREATED CREATED BY
It looks like other people would also like to have this feature, but unfortunately right now it does not seem to exist.
See also this issue and here a related request which got rejected.
If you're fine with saving the complete docker (docker save
) and then extracting a tarball with your layer, then this is possible:
docker run -it
# do fancy stuff in the container
docker commit foobar # create image from container
docker history foobar # will show you the layers
docker save -o foobar.tar foobar # dumps container contents to foobar.tar
Now foobar.tar
will contain the file system states from different times. Inspecting this tarball shows, in my case, a file repositories
with
{"foobar":{"latest":"fdf43d96e691c57e9afb4b85dba2e6745146a7ca9076c7284c6b2e1f93434562"}}
which indicates, that the latest layer is fdf43...
. You can get a tarball with the file system contents of this layer via
tar -x fdf43d96e691c57e9afb4b85dba2e6745146a7ca9076c7284c6b2e1f93434562/layer.tar -f foobar.tar
There is a tool, undocker, which automated this process, but I'm not sure whether it will work with the current format of the saved tar file.