buildah icon indicating copy to clipboard operation
buildah copied to clipboard

Feature Request: "record" a Dockerfile by using sequential buildah run/copy/config etc commands

Open mjml opened this issue 5 years ago • 14 comments

When you author a long Dockerfile/Containerfile, it is increasingly likely that you make mistakes or receive errors from installation tooling during the integration process. Debugging these files can be time consuming since the build must pull GB of data sequentially from various sources.

The proposal is to have a command like buildah record start. Every subsequent Dockerfile-compatible command (run, copy, config) run through buildah would be recorded. After you're done, you could save the log to a would-be Dockerfile for further amendment, re-ordering, documentation, and so on. So there would be a buildah record save <filename> and a buildah record abort.

Obviously this wouldn't capture the details of direct modification of the rootfs that are available via the mount command. But for the purposes of debugging Containerfile creation, this feature would be of great benefit.

mjml avatar Jul 07 '20 07:07 mjml

@nalind WDYT?

I guess we could launch a shell that would record all buildah commands and then generate a Containerfile, when the shell exits.

rhatdan avatar Jul 07 '20 10:07 rhatdan

I was thinking that instead of a shell or repl, buildah would simply check for the existence of a private log file when it runs. If the command is a Dockerfile-compatible command, if it is successful, and if the logfile exists, append the command to that file with the appropriate syntax. The buildah record stop and buildah record abort commands would simply delete the log file and/or copy it to some target path specified by the user.

mjml avatar Jul 07 '20 16:07 mjml

The best way to get this implemented would be to open a PR. :^) The issue with a log file somewhere, is that you can only do one at a time. Which might be ok. A second buildah record start would fail.

rhatdan avatar Jul 07 '20 18:07 rhatdan

@mjml Have you considered contributing a PR for this?

rhatdan avatar Aug 06 '20 17:08 rhatdan

I would like to Dan but at the moment I am swamped. I will revisit my container adventures mid to late fall and may have some more time then.

mjml avatar Aug 07 '20 04:08 mjml

@mjml did you ever do anything with this?

rhatdan avatar Feb 10 '21 19:02 rhatdan

I haven't implemented it, but it doesn't seem like a very difficult feature. I'm not familiar enough with buildah internals to really judge and since I still have a lot going on, I haven't had the chance to revisit.

mjml avatar Feb 10 '21 21:02 mjml

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Mar 13 '21 00:03 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Jun 25 '21 00:06 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Jul 26 '21 00:07 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Aug 26 '21 00:08 github-actions[bot]

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Sep 26 '21 00:09 github-actions[bot]

@flouthoc WDYT?

rhatdan avatar Sep 26 '21 11:09 rhatdan

A friendly reminder that this issue had no activity for 30 days.

github-actions[bot] avatar Oct 27 '21 00:10 github-actions[bot]