Record container commands to produce a Dockerfile

I’m new to both docker and this forum, I’ve searched but cannot find this feature request elsewhere.

Request in brief:
I’d like to suggest a feature which would enable a docker user to record the commands issued during a docker container session in Dockerfile format. Perhaps you’d only bother recording commands which result in file system changes and note those file system changes (in docker diff format?) as Dockerfile comments?

I believe that implementation of this feature request would greatly improve the overall value of docker and make the Dockerfile and ‘docker commit’ features far more coherent in the way they operate together.

I am aware of a project that already exists to do this, so perhaps you could work with them to ‘insource’ this?

Background:
At first I was confused as to why I’d bother creating a Dockerfile when I can simply build up a docker container and commit this to an image. I had many of the same questions and considerations as the OP of this question on StackOverflow. Now I understand that a Dockerfile helps transcend base image updates and updates to other components I may install in a container.

Dockerfiles and ‘docker commit’ do seem to be ambiguous features of docker. Generally docker’s documentation completely omits information on benefits of using different docker features and reasoning for using certain features and best practices. This may be intentional, but is extremely annoying for new starters and may be unnecessarily slowing the uptake of docker by new users. I’ve had a lot of time to read recently - but if I were busy, I would have closed the browser on docker ages ago and simply continued to use VMs.

@qacollective - I get where you are coming from. I’m about two months in with Docker so i’m fairly new as well. It has taken a much bigger time commitment than I ever thought it would. The only thing I can say is that Docker, at least for me, has been something that’s taken me a while to grok. And, until you do, it’s confusing as hell and you find yourself thinking “why am i doing this?” a lot. It’s worth the time and frustration.

Docker requires a very different view of your infrastructure and even though I have a lot of experience (meaning I’m old, lol) that experience was almost a hinderance. The concepts of ephemeral, idempotent infrastructure is odd on many levels compared to what we are used to. It’s easy to understand the terms but for me at least, it took a while to start thinking in that framework.

With that said, some of what you are running into is because Docker has changed so quickly. You feel like there are 5 ways to do everything because there ARE. The worst part is that none of the 5 ways ever seem to do all of what I want even though all of what I want can be accomplished in at least one of the five ways. Grrr.

I love your idea for a recording tool. I’ve been using the bash history from my shell sessions to do that and while it works, it does take some fiddling. I’ll check out your github repo and see if I can help.

Andy

LOL, whoops, didn’t bother to read the date of your post. Seems like the issues are still the same though! Checking out the repo now.

Glad you agree with me on the documentation side too. Perhaps this warrants another feature request - the documents read too much like man pages: ‘this is how you run this command’ … great, but why would I want to run that command? How does that benefit me? What can this command be used to achieve in a larger sense? This is completely lacking. Perhaps I shouldn’t use an example as fine-grained as ‘command’, because there is also very little information available to make higher level decisions like ‘should I make a Dockerfile or build a container and then commit the container to an image?’.

Is there a wiki where we can just contribute content, I wonder?