Add Dockerfile contents to docker image meta data

I created some docker images a year or so ago and have lost the Dockefiles that created them. It would be great to be able to find the original Dockerfile from the image to update them. Also, it would also help foster trust in the use of images from others.

The best way is to store the Dockerfile and related files in some sort of versioning system. In most of the cases there will be other external files, configurations etc, that is outside the Dockerfile which results in the final Docker image, so getting back the Dockerfile alone will not be of much help. And storing all the related files and Dockerfile into the image will make the Image size bigger and bigger. Now if you are just looking at a way to find the steps that was inside the dockerfile, you can always execute a docker history on the image and get what instructions each layer of the image was created from.

Eg:

 docker history firefox
IMAGE               CREATED             CREATED BY                                      SIZE                COMMENT
3789368fcfb8        2 weeks ago         /bin/sh -c #(nop) CMD ["x11vnc" "-forever" "-   0 B
780afe072018        2 weeks ago         /bin/sh -c #(nop) EXPOSE 5900/tcp               0 B
95fb713d000d        2 weeks ago         /bin/sh -c bash -c 'echo "firefox" >> /.bashr   8 B
ff8438c9e9c9        2 weeks ago         /bin/sh -c x11vnc -storepasswd 1234 ~/.vnc/pa   8 B
d0a7653faec5        2 weeks ago         /bin/sh -c mkdir ~/.vnc                         0 B
039c771919a9        2 weeks ago         /bin/sh -c apt-get update && apt-get install    248.3 MB
91e54dfb1179        9 weeks ago         /bin/sh -c #(nop) CMD ["/bin/bash"]             0 B
d74508fb6632        9 weeks ago         /bin/sh -c sed -i 's/^#\s*\(deb.*universe\)$/   1.895 kB
c22013c84729        9 weeks ago         /bin/sh -c echo '#!/bin/sh' > /usr/sbin/polic   194.5 kB
d3a1f33e8a5a        9 weeks ago         /bin/sh -c #(nop) ADD file:5a3f9e9ab88e725d60   188.2 MB

Regards