Containerization allows developers to define the execution environment in which their software needs to be installed. Docker is the leading platform in this field, and developers that use it are required to write a Dockerfile for their software. Writing Dockerfiles is far from trivial, especially when the system has unusual requirements for its execution environment. Despite several tools exist to support developers in writing Dockerfiles, none of them is able to generate entire Dockerfiles from scratch given a high-level specification of the requirements of the execution environment. In this paper, we present a study in which we aim at understanding to what extent Deep Learning (DL), which has been proven successful for other coding tasks, can be used for this specific coding task. We preliminarily defined a structured natural language specification for Dockerfile requirements and a methodology that we use to automatically infer the requirements from the largest dataset of Dockerfiles currently available. We used the obtained dataset, with 670,982 instances, to train and test a Text-to-Text Transfer Transformer (T5) model, following the current state-of-the-art procedure for coding tasks, to automatically generate Dockerfiles from the structured specifications. The results of our evaluation show that T5 performs similarly to the more trivial IR-based baselines we considered. We also report the open challenges associated with the application of deep learning in the context of Dockerfile generation.
翻译:容器化技术允许开发者定义其软件所需的执行环境。Docker是该领域的领先平台,使用该平台的开发者需要为其软件编写Dockerfile。编写Dockerfile并非易事,尤其当系统对执行环境有特殊要求时尤为困难。尽管已有多种工具支持开发者编写Dockerfile,但尚无工具能够根据执行环境需求的高级规范从零开始生成完整的Dockerfile。本文旨在探究深度学习(DL)在特定编码任务中的适用性——该技术已在其他编码任务中展现出成功应用。我们初步定义了Dockerfile需求的结构化自然语言规范,并建立了一套方法,用于从当前规模最大的Dockerfile数据集中自动推断需求。我们利用所获取的包含670,982个实例的数据集,遵循当前最先进的编码任务处理流程,训练并测试了文本到文本迁移转换器(T5)模型,以实现从结构化规范自动生成Dockerfile。评估结果表明,T5模型的性能与我们考虑的基于信息检索的基线方法相当。此外,我们还报告了将深度学习应用于Dockerfile生成领域所面临的开放挑战。