Implementation and Analysis of Container Image Optimization Using Alpine Linux and Multi-Stage Builds

Authors

DOI:

https://doi.org/10.34148/teknika.v14i1.1118

Keywords:

Optimization, Docker Image, Size, Building Time, Vulnerability

Abstract

Containerization enables isolation within a host, with Docker being a popular tool for packaging applications and their dependencies in container images. However, challenges like slow build processes and bloated image sizes can consume resources, slow down builds, and pose security risks. This study optimizes Docker images by combining the Alpine base image with multi-stage builds, analyzing size, build speed, and security across different combinations and environments to identify and propose the most efficient combination solution. The approach used is a quantitative quasi-experiment with a within-subject design. The sample used was a JavaScript framework, with the main experimental group being the combination of Alpine and multi-stage builds, while the comparison group included combinations of Node and Node-Alpine, both in single-stage and multi-stage configurations, as well as single-stage Alpine. Data was obtained from CI/CD, container registry, and Trivy reports. Analyzed by descriptive analysis, One-Way ANOVA or Kruskal Wallis test, and post-hoc test. The results show that combining multi-stage builds with Alpine is considered best practice because it produces the smallest image size, reducing it by up to 94% compared to single-stage Node. It also achieves the shortest build times across all environments and presents low vulnerability issues. However, it is important to note that while the Alpine multi-stage combination offers the most efficient build times, it experiences a 1.3x increase in duration in low-spec environments.

Downloads

Download data is not yet available.

References

[1] P. Muzumdar, A. Bhosale, G. P. Basyal, and G. Kurian, “Navigating the Docker Ecosystem: A Comprehensive Taxonomy and Survey,” Asian Journal of Research in Computer Science, vol. 17, no. 1, pp. 42–61, 2024, doi: 10.9734/ajrcos/2024/v17i1411.

[2] S. Tarasiuk, D. Traczuk, K. Szczepaniuk, P. Stoń, and J. Smołka, “Performance evaluation of designated containerization and virtualization solutions using a synthetic benchmark,” Journal of Computer Sciences Institute, vol. 32, pp. 157–162, 2024, doi: 10.35784/jcsi.6231.

[3] O. I. Alqaisi, A. Şaman Tosun, and T. Korkmaz, “Performance Analysis of Container Technologies for Computer Vision Applications on Edge Devices,” IEEE Access, vol. 12, pp. 41852–41869, 2024, doi: 10.1109/ACCESS.2024.3376570.

[4] I. P. A. Eka Pratama and I. M. Raharja, “Node.js Performance Benchmarking and Analysis at Virtualbox, Docker, and Podman Environment Using Node-Bench Method,” JOIV : International Journal on Informatics Visualization, vol. 7, p. 2240, Dec. 2023, doi: 10.30630/joiv.7.4.01762.

[5] C. Mukmin, T. Naraloka, and Q. H. Andriyanto, “Analisis Perbandingan Kinerja Layanan Container As A Service (CAAS) Studi Kasus : Docker dan Podman,” Kumpulan jurnaL Ilmu Komputer (KLIK), vol. 08, no. 2, pp. 152–161, 2021, doi: http://dx.doi.org/10.20527/klik.v8i2.

[6] Stack Overflow, “Technology | 2024 Stack Overflow Developer Survey.” Accessed: Oct. 07, 2024. [Online]. Available: https://survey.stackoverflow.co/2024/technology/

[7] A. R. Ekaputra and A. S. Affandi, “Pemanfaatan layanan cloud computing dan docker container untuk meningkatkan kinerja aplikasi web,” Journal of Information System and Application Development, vol. 1, no. 2, pp. 138–147, 2023, doi: 10.26905/jisad.v1i2.11084.

[8] A. M. Potdar, N. D G, S. Kengond, and M. M. Mulla, “Performance Evaluation of Docker Container and Virtual Machine,” Procedia Comput Sci, vol. 171, pp. 1419–1428, 2020, doi: https://doi.org/10.1016/j.procs.2020.04.152.

[9] S. Prayetno and B. Santoso, “Penerapan Docker Container Guna Mempermudah Deployment Dan Maintenance Aplikasi Web (Studi Kasus PT.Gogomedia Visindo),” Jurnal Sistem Informasi dan Teknologi Informatika, vol. 1, no. 1, pp. 37–49, 2023.

[10] S. Dwiyatno, E. Rachmat, A. P. Sari, and O. Gustiawan, “Implementasi Virtualisasi Server Berbasis Docker Container,” PROSISKO: Jurnal Pengembangan Riset dan Observasi Sistem Komputer, vol. 7, no. 2, pp. 165–175, 2020, doi: 10.30656/prosisko.v7i2.2520.

[11] R. Felani, M. N. Al Azam, D. P. Adi, A. Widodo, and A. B. Gumelar, “Optimizing Virtual Resources Management Using Docker on Cloud Applications,” IJCCS (Indonesian Journal of Computing and Cybernetics Systems), vol. 14, no. 3, p. 319, 2020, doi: 10.22146/ijccs.57565.

[12] S. Gholami, H. Khazaei, and C.-P. Bezemer, “Should you Upgrade Official Docker Hub Images in Production Environments?,” in 2021 IEEE/ACM 43rd International Conference on Software Engineering: New Ideas and Emerging Results (ICSE-NIER), Institute of Electrical and Electronics Engineers, 2021, pp. 101–105. doi: 10.1109/ICSE-NIER52604.2021.00029.

[13] N. Zhao et al., “Large-Scale Analysis of Docker Images and Performance Implications for Container Storage Systems,” IEEE Transactions on Parallel and Distributed Systems, vol. 32, no. 4, pp. 918–930, 2021, doi: 10.1109/TPDS.2020.3034517.

[14] C. Lin, S. Nadi, and H. Khazaei, “A Large-scale Data Set and an Empirical Study of Docker Images Hosted on Docker Hub,” in 2020 IEEE International Conference on Software Maintenance and Evolution (ICSME), Institute of Electrical and Electronics Engineers, 2020, pp. 371–381. doi: 10.1109/ICSME46990.2020.00043.

[15] C. Tipantuña, A. Yazán, and J. Carvajal-Rodriguez, “Containers-Based Network Services Deployment: A Practical Approach,” Enfoque UTE, vol. 15, no. 1, pp. 36–44, 2024, doi: 10.29019/enfoqueute.1005.

[16] F. B. Fava et al., “Assessing the Performance of Docker in Docker Containers for Microservice-Based Architectures,” in 2024 32nd Euromicro International Conference on Parallel, Distributed and Network-Based Processing (PDP), Institute of Electrical and Electronics Engineers, 2024, pp. 137–142. doi: 10.1109/PDP62718.2024.00026.

[17] N. Badisa, J. K. Grandhi, L. Kallam, M. R. Eda, S. Nulaka, and S. Bulla, “Efficient Docker Image Optimization using Multi-Stage Builds and Nginx for Enhanced Application Deployment,” 2023. doi: 10.21203/rs.3.rs-3276965/v1.

[18] M. U. Haque and M. A. Babar, “Well Begun is Half Done: An Empirical Study of Exploitability & Impact of Base-Image Vulnerabilities,” in 2022 IEEE International Conference on Software Analysis, Evolution and Reengineering (SANER), Institute of Electrical and Electronics Engineers, 2022, pp. 1066–1077. doi: 10.1109/SANER53432.2022.00124.

[19] Docker, “Docker Docs | BuildKit.” Accessed: Jul. 22, 2024. [Online]. Available: https://docs.docker.com/build/buildkit/

[20] B. Erdenebat and T. Kozsik, “Comparative Analysis of Container Build Methods: A Performance Evaluation,” in 2024 47th MIPRO ICT and Electronics Convention (MIPRO), Institute of Electrical and Electronics Engineers, 2024, pp. 1960–1966. doi: 10.1109/MIPRO60963.2024.10569255.

[21] I. P. A. Eka Pratama, “Pengujian Performansi Lima Back-End JavaScript Framework Menggunakan Metode GET dan POST,” Jurnal RESTI (Rekayasa Sistem dan Teknologi Informasi), vol. 4, no. 6, p. 1216, Dec. 2020, doi: 10.29207/resti.v4i6.2675.

[22] R. D. Marcus, A. S. Ilmananda, L. Indana, and H. A. Aswari, “Optimalisasi Manajemen Jaringan pada Laboratorium Komputer Melalui Implementasi Remote Installation Services,” Jurnal MediaTIK, vol. 6, no. 3, pp. 79–85, 2023, doi: https://doi.org/10.26858/jmtik.v6i3.51964.

[23] P. R. Perkasa and E. Mailoa, “Adopsi Devsecops Untuk Mendukung Metode Agile Menggunakan Trivy Sebagai Security Scanner Docker Image Dan Dockerfile,” Jurnal Indonesia : Manajemen Informatika dan Komunikasi, vol. 4, no. 3, pp. 856–863, 2023, doi: 10.35870/jimik.v4i3.291.

[24] S. Yu, W. Song, X. Hu, and H. Yin, “On the Correctness of Metadata-Based SBOM Generation: A Differential Analysis Approach,” in 2024 54th Annual IEEE/IFIP International Conference on Dependable Systems and Networks (DSN), Institute of Electrical and Electronics Engineers Inc., 2024, pp. 29–36. doi: 10.1109/DSN58291.2024.00018.

[25] S. H. Majumder, S. Jajodia, S. Majumdar, and M. S. Hossain, “Layered Security Analysis for Container Images: Expanding Lightweight Pre-Deployment Scanning,” in 2023 20th Annual International Conference on Privacy, Security and Trust (PST), Institute of Electrical and Electronics Engineers, 2023, pp. 1–10. doi: 10.1109/PST58708.2023.10320152.

[26] G.- Mardiatmoko, “Pentingnya Uji Asumsi Klasik Pada Analisis Regresi Linier Berganda,” BAREKENG: Jurnal Ilmu Matematika dan Terapan, vol. 14, no. 3, pp. 333–342, 2020, doi: 10.30598/barekengvol14iss3pp333-342.

[27] R. Sianturi, “Uji homogenitas sebagai syarat pengujian analisis,” Jurnal Pendidikan, Sains Sosial, dan Agama, vol. 8, no. 1, pp. 386–397, 2022, doi: 10.53565/pssa.v8i1.507.

Implementation and Analysis of Container Image Optimization Using Alpine Linux and Multi-Stage Builds

Downloads

Published

2025-03-03

Issue

Section

Articles

How to Cite

Implementation and Analysis of Container Image Optimization Using Alpine Linux and Multi-Stage Builds. (2025). Teknika, 14(1), 9-18. https://doi.org/10.34148/teknika.v14i1.1118