ICSE 2026
Sun 12 - Sat 18 April 2026 Rio de Janeiro, Brazil

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 im- age 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 31 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.