paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Automatic Dockerfile Generation with Large Language Models

基于大语言模型的 Dockerfile 自动生成
ICSE Proceedings of the 2026 IEEE/ACM 48th International Conference on Software Engineering2026匹配度 2/10 · 该论文将 LLM 用作自动生成并迭代修复 Dockerfile 的工具,属于 LLM 辅助构建配置生成的软件工程任务;它既未在 ML/Agent 程序中应用静态分析,也未用 LLM/Agent 改进静态分析或形式化验证,与用户关注的浮点程序分析、贝叶斯程序分析等核心方向无直接交集。迭代修复的 Agent 循环虽有一定形式上的相似,但分析对象是构建脚本而非程序语义。引用 0 inbox
Jun Lyu, He Zhang, Yusong Yuan, Lanxin Yang, Yue Li, Manuel Rigger
crossref: 2026-09-12

AI 速览

一句话:提出 DRAFT,利用 LLM 迭代修复并优化 Dockerfile,实现自动生成可成功构建的镜像。

针对项目常缺少 Dockerfile、开发者需反复试错构建的问题,论文提出 DRAFT。DRAFT 模拟开发者迭代行为:先生成初始 Dockerfile,再根据构建反馈迭代提示 LLM 生成补丁,直到成功执行;随后优化镜像体积。作者在 35 个 C、Java、Go、Python、Ruby 项目上评估,并与 Copilot、Actions_remaker、Repo2docker、Boxing、Starter 比较。DRAFT 成功为 28 个项目生成 Dockerfile,成功率 80%,显著高于对比工具;生成时间最大 19.57 分钟、中位数 33.78 秒,镜像体积减少 67.14%,构建时间减少 3.62%。该工具可减轻手工创建构建规范的负担。

问题
项目常缺少 Dockerfile,开发者需根据自然语言文档反复试错,才能发现正确的构建步骤与依赖。
方法
DRAFT 用 LLM 迭代生成并修复 Dockerfile:根据执行反馈生成补丁直至构建成功,再优化镜像大小。
评估
在 35 个多语言项目上与 Copilot、Actions_remaker、Repo2docker、Boxing、Starter 比较,报告成功率、生成时间、镜像体积与构建时间。
原文摘要(Abstract)

Project maintainers on platforms like GitHub usually provide a document (e.g., a Readme) describing how to build and use their software, whose instructions, often written in natural language, might sometimes be ambiguous or platform-specific. This task can be eased by containerization, which allows developers to define the build environments required for their software and to enable automatic builds. Docker is the leading platform in this field and relies on Dockerfiles for correct execution. Practitioners who want to use and build projects that do not include a Dockerfile need to develop it themselves. They often need to perform multiple builds by trial and error to discover the correct build steps and build dependencies (e.g., third-party library necessary for software builds). To address this challenge, we propose a novel approach and tool called Dockerfile Refinement and Fixing Tool (DRAFT), which can automatically generate a working Dockerfile by a Large Language Model (LLM). The core idea of DRAFT is that it emulates developers’ behavior iteratively. Specifically, DRAFT is used to iteratively generate prompts to instruct the LLM to generate patches for an initially generated Dockerfile until it executes successfully. Subsequently, it attempts to optimize the Dockerfile to reduce the size of the image it builds. We evaluated DRAFT on 35 projects and compared it with the Dockerfiles generated by Copilot (based on ChatGPT 4.0), Actions_remaker, Repo2docker, Boxing, and Starter in five different languages (C, Java, Go, Python, and Ruby). The evaluation results show that DRAFT can successfully generate Dockerfiles for 28 projects, resulting in a success rate of 80%, which is much higher than all compared tools. The time consumed by DRAFT on generating Dockerfiles is 19.57 minutes at maximum with the median at 33.78s. Using DRAFT can reduce image size by 67.14% and build time by 3.62%. DRAFT relieves practitioners from the burden of manually creating build specifications.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot11582,
  title = {Automatic Dockerfile Generation with Large Language Models},
  author = {Jun Lyu and He Zhang and Yusong Yuan and Lanxin Yang and Yue Li and Manuel Rigger},
  booktitle = {ICSE},
  year = {2026},
  doi = {10.1145/3744916.3773162}
}