Docker is a popular tool for developers and organizations to package, deploy, and run applications in a lightweight, portable container. One key component of Docker is the Dockerfile, a simple text file that specifies the steps needed to build a Docker image. While Dockerfiles are easy to create and use, creating an optimal image is complex in particular since it is easy to not follow the best practices, when it happens we call it Docker smell. To improve the quality of Dockerfiles, previous works have focused on detecting Docker smells, but they do not offer suggestions or repair the smells. In this paper, we propose, Parfum, a tool that detects and automatically repairs Docker smells while producing minimal patches. Parfum is based on a new Dockerfile AST parser called Dinghy. We evaluate the effectiveness of Parfum by analyzing and repairing a large set of Dockerfiles and comparing it against existing tools. We also measure the impact of the repair on the Docker image in terms of build failure and image size. Finally, we opened 35 pull requests to collect developers' feedback and ensure that the repairs and the smells are meaningful. Our results show that Parfum is able to repair 806 245 Docker smells and have a significant impact on the Docker image size, and finally, developers are welcoming the patches generated by Parfum while merging 20 pull requests.
翻译:Docker 是开发者和组织在轻便便携式容器中包装、部署和运行应用程序的流行工具。 Docker 的关键组件是 Docker 文件, 是一个简单的文本文件, 规定了建立 Docker 图像所需的步骤。 虽然 Dockker 文件容易创建和使用, 创建最佳图像尤其复杂, 因为当我们把它称为 Docker 气味时, 很容易不遵循最佳做法。 为改善 Docker 文件的质量, 以前的工作重点是检测 Docker 气味, 但是它们不提供建议或修复气味。 在本文中, 我们提议, Parfum, 这是一种工具, 用来检测和自动修理 Docker 气味, 并且提供最小的补味。 Parfum 以名为 Dinghy的新 Docker 文件为基础, 我们通过分析和修理大量Dockerfum, 对照现有工具来评估 Parfum 的效果。 我们还从构建失败和图像大小的角度衡量了 Docker 。 最后, 我们开启了35 请求收集开发者的反馈, 并且确保修理和自动修复 Darker 气味 。