arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2104.05490cs.SE
收藏

DockerMock:通过模拟指令执行预构建检测Dockerfile故障

DockerMock: Pre-Build Detection of Dockerfile Faults through Mocking Instruction Execution

Mingjie Li, Xiaoying Bai, Minghua Ma, Dan Pei

摘要:

持续集成(CI)和持续部署(CD)是软件工程实践中广泛采用的方法。实际上,CI/CD管道的执行还不是可靠的连续的,因为它经常被Docker构建失败中断。然而,现有的尝试和错误的做法来检测故障是耗时的。为了及时检测Dockerfile错误,提出了一种基于上下文的预构建分析方法DockerMock,通过模拟常见Dockerfile指令的执行来检测Dockerfile错误。当指令与近似和累积的运行上下文冲突时,会声明Dockerfile错误。通过显式地跟踪上下文是否模糊,DockerMock在检测精度和召回率之间取得了很好的平衡。我们对DockerMock进行了评估,在GitHub上的开源项目的41个Dockerfiles中发现了53个错误,在学生课程项目的105个Dockerfiles中发现了130个错误。平均而言,DockerMock在这两个数据集中检测到68.0%的Dockerfile错误。而基线hadolint检测到6.5%,基线BuildKit检测到60.5%没有指令执行。在GitHub数据集中,DockerMock将构建数量减少到47个,优于hadolint(73)和BuildKit(74)。

英文摘要:

Continuous Integration (CI) and Continuous Deployment (CD) are widely adopted in software engineering practice. In reality, the CI/CD pipeline execution is not yet reliably continuous because it is often interrupted by Docker build failures. However, the existing trial-and-error practice to detect faults is time-consuming. To timely detect Dockerfile faults, we propose a context-based pre-build analysis approach, named DockerMock, through mocking the execution of common Dockerfile instructions. A Dockerfile fault is declared when an instruction conflicts with the approximated and accumulated running context. By explicitly keeping track of whether the context is fuzzy, DockerMock strikes a good balance of detection precision and recall. We evaluated DockerMock with 53 faults in 41 Dockerfiles from open source projects on GitHub and 130 faults in 105 Dockerfiles from student course projects. On average, DockerMock detected 68.0% Dockerfile faults in these two datasets. While baseline hadolint detected 6.5%, and baseline BuildKit detected 60.5% without instruction execution. In the GitHub dataset, DockerMock reduces the number of builds to 47, outperforming that of hadolint (73) and BuildKit (74).

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑