| ID: R7 | Licence: Apache License V2.0 |
Owner: UNISS |
Contacts: mfadda1@uniss.it pruiu@uniss.it rdelussu@uniss.it |
| Short Description | A tool for Dockerfile optimization built around an LLM-based chatbot. The chatbot takes a Dockerfile as input and generates an alternative configuration according to a user-selected objective: performance, energy efficiency, memory usage, dependency management or security hardening. Separate analysis functionalities let the user compare this candidate configuration with the original one. |
| Key features | – LLM-based chatbot: prompt-based, one optimization objective at a time, choice among several locally-run models. – Separate analysis: static comparison and build-based evaluation of the candidate configuration. – Optional RAG: information on software packages and known vulnerabilities for security hardening. – Conversational refinement: explanations, refinements or alternative solutions on request. |
| Require | – A Dockerfile, with its build context for the build-based analysis. – The optimization objective. |
| Provide | – A candidate optimised version of the Dockerfile. – Its comparison with the original one. |
| Input | – Dockerfile. – Optimization objective. – Selected LLM. |
| Output | – Candidate optimised Dockerfile. – Comparison with the original: static analysis and build metrics (build status, build time, image size, number of layers). – Explanations on request. |
| User | – Software developers that want to package their applications as containers for the computing continuum. |
| Benefits for the user | – A candidate optimised version of the container configuration, to improve the performance or the efficiency of the application (the application must already be described by a Dockerfile). |
| Download | github.com/RDelussu/ChatbotWL |
| Role in MYRTUS | – Optimization of Dockerfiles at design time, after the DPE has produced the application artefacts and before the container image is published to the container registry. |
| TRL@M0 | 2 |
| TRL@M36 | 3-4 |
General description
The proposed tool supports the optimization of Dockerfiles through an LLM-based chatbot, complemented by separate analysis functionalities. It enables users to upload a Dockerfile, select one of the available LLMs, and choose one objective among performance, security hardening, memory usage, dependency management, and energy efficiency. The chatbot then generates an alternative version of the input configuration, and the analysis functionalities evaluate it at multiple levels, including static comparison between the original and optimized code, dynamic evaluation based on build metrics such as image size, number of layers, and build time, and optional vulnerability assessment through a Retrieval-Augmented Generation (RAG) mechanism providing information on software packages and known vulnerabilities. In addition, the chatbot allows post-optimization interaction, enabling users to request explanations, refinements, or alternative solutions.
By combining code generation, analytical evaluation, and conversational capabilities, the tool aims to improve the efficiency, security, and maintainability of containerized applications in a unified and user-friendly workflow. Optimization is meant here in a practical sense: the chatbot does not converge to a formally defined optimum, but proposes a candidate configuration that the user can inspect, refine and evaluate against the original one.
MYRTUS Extension/Contribution
The main contribution of this work is the design and implementation of a unified AI-driven framework that integrates container configuration optimization, multi-level analysis, and conversational interaction within a single system. Unlike traditional approaches that focus separately on static linting, manual optimization, or security scanning tools, our solution combines these aspects into a coherent workflow powered by large language models. The system extends existing practices by introducing an optimization mechanism for Docker configurations, allowing users to target performance, security, memory, dependency, and energy efficiency. Furthermore, it enhances validation through both static and dynamic analysis, providing measurable feedback based on build-time metrics such as image size, number of layers, and build duration. Another key contribution is the integration of an optional Retrieval-Augmented Generation (RAG) module that supports security hardening with information on known vulnerabilities. Finally, the separation between optimization and conversational models enables specialized handling of code generation and reasoning tasks, improving both output quality and user interaction.
Within MYRTUS, the tool belongs to the containerization workflow of the reference infrastructure: it works on the Dockerfile of an application before the resulting image is built and published to the container registry. It has been evaluated as a standalone tool on a large public dataset of Dockerfiles, where the optimised configurations reduced build time in most of the buildable cases. It is not part of the deployment pipeline of the running infrastructure.
Technology Benefits and Innovations
The core innovation of this result lies in the integration of AI-driven optimization, automated analysis, and conversational assistance within a unified framework for container configuration management. The system leverages large language models to automatically generate candidate optimised Dockerfiles based on a user-selected objective, such as performance, security, memory efficiency, dependency reduction, or energy optimization. Its design follows a modular and extensible architecture that combines code generation, static analysis, dynamic validation, and vulnerability assessment, enabling users to evaluate optimization outcomes from different perspectives. Furthermore, the separation between specialized optimization models and conversational models allows the system to exploit the strengths of each model type, improving both code generation quality and user interaction capabilities.
Current approaches to container optimization often rely on a collection of disconnected tools, such as linters, security scanners, performance analyzers, and manual code reviews, requiring significant expertise and effort to obtain comprehensive results. The proposed system addresses this gap by providing an integrated workflow that supports the optimization process, from code generation to validation and explanation. Through static and dynamic analyses, users can quantitatively and qualitatively assess the impact of optimizations, while the optional Retrieval-Augmented Generation (RAG) component enriches vulnerability assessments with up-to-date external knowledge. This approach reduces the complexity of managing container configurations, improves development productivity, promotes security best practices, and facilitates the adoption of optimized container deployments by both expert and non-expert users.
Users
The primary users of this result are DevOps engineers, cloud architects, software developers, and platform engineers who are responsible for creating, maintaining, and deploying containerized applications using Docker and Kubernetes. These users can leverage the tool to obtain candidate optimised configuration files, improve deployment efficiency, and identify potential security issues without relying on multiple disconnected tools. The solution is also relevant for security engineers and compliance teams who need to assess vulnerabilities and enforce secure configuration practices in containerized environments. In addition, the conversational interface makes the platform accessible to less experienced developers, and practitioners who may not have extensive expertise in container optimization but can benefit from AI-generated recommendations and explanations.
Application Domains
The proposed system is applicable to several domains where containerization and cloud-native technologies play a central role, including software development, DevOps, cloud computing, cybersecurity, enterprise IT, and edge/cloud deployment environments. Its primary application is the optimization and analysis of Docker configurations, helping organizations improve deployment efficiency, reduce resource consumption, and enhance security.
Within the context of MYRTUS, the solution is part of the containerization workflow of the MYRTUS Reference Infrastructure: it operates after the Design and Programming Environment (DPE) has produced the application and before the container image is made available for deployment. In particular, it can be used to assist developers during the design phase by generating candidate container configurations and evaluating alternative configurations according to different objectives such as performance, security, memory usage, and energy efficiency. Since this solution was developed within the MYRTUS context, it has not been previously adopted in other projects; however, it builds upon established practices in AI-assisted code generation, container optimization, and automated software quality analysis.
References
- GitHub repository: github.com/RDelussu/ChatbotWL
- Dataset used for the evaluation: J. Henkel et al., 2020
