I\'m just starting out with Docker, and it would be very helpful to be able to see the Dockerfiles used to create existing docker images.
Even if the image was buil
There's a project dockerfile-from-image which could help you to do it directly.
It requires a single CLI command to recover the Dockerfile:
docker run -v /var/run/docker.sock:/var/run/docker.sock centurylink/dockerfile-from-image <IMAGE_TAG_OR_ID>
One has to have Docker already installed.
You have docker history <image>
that is very helpful. It can even be used to generate a dockerfile if none of the steps involved stdin.
If a step as stdin, the only way to know what happened would be to do docker logs <container id parent>
, but if you do not have the container, you can't.
There is undocker available now. We can install it by using the pip command.
pip install git+https://github.com/larsks/undocker/
and use
docker save IMAGE_NAME | undocker -i -o IMAGE_NAME
to extract the files from docker.
https://github.com/larsks/undocker/