Doctor: Optimizing Container Rebuild Efficiency by Instruction Re-orchestration
Zhiling Zhu, Tieming Chen, Chengwei Liu, Han Liu, Qijie Song, Zhengzi Xu, Yang Liu
Abstract
Containerization has revolutionized software deployment, with Docker leading the way due to its ease of use and consistent runtime environment. As Docker usage grows, optimizing Dockerfile performance, particularly by reducing rebuild time, has become essential for maintaining efficient CI/CD pipelines. However, existing optimization approaches primarily address single builds without considering the recurring rebuild costs associated with modifications and evolution, limiting long-term efficiency gains. To bridge this gap, we present Doctor, a method for improving Dockerfile build efficiency through instruction re-ordering that addresses key challenges: identifying instruction dependencies, predicting future modifications, ensuring behavioral equivalence, and managing the optimization’s computational complexity. We developed a comprehensive dependency taxonomy based on Dockerfile syntax and a historical modification analysis to prioritize frequently modified instructions. Using a weighted topological sorting algorithm, Doctor optimizes instruction order to minimize future rebuild time while maintaining functionality. Experiments on 2,000 GitHub repositories show that Doctor improves 92.75% of Dockerfiles, reducing rebuild time by an average of 26.5%, with 12.82% of files achieving over a 50% reduction. Notably, 86.2% of cases preserve functional similarity. These findings highlight best practices for Dockerfile management, enabling developers to enhance Docker efficiency through informed optimization strategies.
Ask about this paper
Your agent reads all of it.
Lune indexed this paper to the last equation, along with the top-tier papers that cite it. Ask a question and the answer quotes them.
Your agent calls
Luneget_paper_fulltext
Free to start. No credit card required.
Terminal
Install the CLIlune papers fulltext 07c87e54-90b5-4be1-9010-cacd3987c742Builds on4
- Shipwright: A Human-in-the-Loop System for Dockerfile RepairJordan Henkel, Denini Silva, Leopoldo Teixeira, Marcelo d'Amorim et al.ICSE 2021 · 31 citations
- Understanding and Predicting Docker Build Duration: An Empirical Study of Containerized Workflow of OSS ProjectsYiwen Wu, Yang Zhang, Kele Xu, Tao Wang et al.ASE 2022 · 13 citations
- Empirical Study of the Docker Smells Impact on the Image SizeThomas DurieuxICSE 2024 · 11 citations
- Dockerfile Flakiness: Characterization and RepairTaha Shabani, Noor Nashid, Parsa Alian, Ali MesbahICSE 2025 · 2 citations
Related papers
- Towards Efficient Build Ordering for Incremental Builds with Multiple ConfigurationsJun Lyu, Shanshan Li, He Zhang, Lanxin Yang et al.FSE 2024 · 4 citations
- Automatic Dockerfile Generation with Large Language ModelsJun Lyu, He Zhang, Yusong Yuan, Lanxin Yang et al.ICSE 2026
- Automated Dependency Optimization for Artifact-Based Build SystemsHongxu Xu, Zhenyang Xu, Shane McIntosh, Chengnian SunISSTA 2026
- Refactorings and Technical Debt in Docker Projects: An Empirical StudyEmna Ksontini, Marouane Kessentini, Thiago do Nascimento Ferreira, Foyzul HassanASE 2021 · 17 citations
- Modus: a Datalog dialect for building container imagesChris Tomy, Tingmao Wang, Earl T. Barr, Sergey MechtaevFSE 2022 · 3 citations
