Skip to main navigation Skip to search Skip to main content

Repairing Docker Smells with Large Language Models: An Empirical Study

  • Chenhui Zhang
  • , Haiyan Wang
  • , Junyi Zhu
  • , Zhaoquan Gu*
  • , Le Wang*
  • *Corresponding author for this work
  • Harbin Institute of Technology
  • Pengcheng Laboratory
  • Southern University of Science and Technology
  • Guangzhou University

Research output: Contribution to journalArticlepeer-review

Abstract

Docker simplifies application deployment, yet improperly written Dockerfiles often lead to suboptimal images with security and efficiency issues, termed “Docker smell”. Existing approaches for the identification and repair of Docker smells predominantly rely on expert-defined static rules, which exhibit notable limitations when addressing structurally complex or infrequent smells. This paper proposes a novel Detect–Guide–Repair (DGR) framework, which integrates rule-based smell detection with a context-aware repair mechanism driven by large language models (LLMs), enabling a more flexible and intelligent automated repair process. We systematically evaluated DGR on 417 real Dockerfiles from prominent GitHub projects. Experimental results show that DGR reduces the number of smells to 44.68% of the original while maintaining a build success rate of 89.20%, demonstrating significant improvements in both repair effectiveness and usability. Furthermore, we present three practical enhancement pathways: (1) a hybrid strategy combining rules and DGR to improve repair effectiveness further; (2) an automated error-correction mechanism to restore buildability; and (3) task-specific model fine-tuning to enable efficient deployment of smaller models. Collectively, these approaches provide a promising empirical foundation for automated Docker smell repair.

Original languageEnglish
Article number6805
JournalApplied Sciences (Switzerland)
Volume16
Issue number13
DOIs
StatePublished - Jul 2026
Externally publishedYes

Keywords

  • Docker smell
  • Dockerfile
  • automated program repair
  • empirical study
  • large language model
  • software maintenance

Fingerprint

Dive into the research topics of 'Repairing Docker Smells with Large Language Models: An Empirical Study'. Together they form a unique fingerprint.

Cite this