Skip to content
Open access

Repairing Docker Smells with Large Language Models: An Empirical Study

Jul 2026 · Applied Sciences · 0 citations · 26 references

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.

Read PDF