Place repo2docker generated `Dockerfile` in the built image?

Do you copy your Dockerfile into your container images? Is it useful? A waste of space? My question: should repo2docker do this?


I learnt that some people copy the Dockerfile into their images. I had never thought of this before. Seems interesting and a “cheap” thing to do. What I am wondering is if there are any downsides? One downside is that we specify that “the intermediate Dockerfile that is generated is a implementation detail” to stop people from relying on it existing because we want to keep the door open to switching to a different way of creating container images (if we want to do that).

Slightly off-topic yet related: We already add the repo2docker version used to build the image as a label to the container image. This lets you go back to exactly that version if you want to rebuild the image. However I don’t think you can access the value of the label from inside the running container.

In general this makes me wonder if we should place “special” files in the root of the image. There have been use cases like “let me determine I am in a repo2docker built container” and such. Which (I think) all require some special file(s) in the root directory.

What do people think? Have you been copying Dockerfiles into images and think it is the best thing ever? Did you used to but stop doing so?