Wednesday, 8 January 2025

Integration of Cloud Technologies with the Metaverse

The potential impact and timeline for the development of the Metaverse remain uncertain, with ongoing debate over whether it represents a mere rebranding of existing technologies or a revolutionary shift. While its core attributes have been identified, challenges such as persistence, interoperability, and scalability persist. 
 
This contribution examines the role of cloud technologies in addressing these challenges and enabling the realization of the Metaverse. Cloud computing offers scalability, flexibility, and distributed infrastructure, making it a competitive paradigm for supporting the Metaverse. However, challenges such as latency and bandwidth limitations necessitate a hybrid approach that integrates edge computing for real-time responsiveness and immersive user experiences. 
 
The study establishes the framework for further investigation into the capability of current cloud providers in supporting the development of the Metaverse.
 
Keywords—metaverse, cloud technology, cloud computing, edge computing 
 
Photo by cottonbro studio
I. INTRODUCTION

Although there is no universally accepted definition of the Metaverse, it is theoretically envisioned as a persistent, all-encompassing virtual world where users can primarily lead digital lives. This interconnected virtual space should integrate various virtual environments, allowing people to perform many activities currently done in the physical world within a single platform [1]. The Metaverse can also signal the future direction of the internet: it seems to suggest a trend where users experience a ubiquitous and persistent virtual layer that surrounds or immerses them [2].

It is difficult to assess the actual impact of the Metaverse and how long its development will take until it reaches its full potential, considering that the status of the Metaverse remains uncertain, with ongoing debate regarding whether it represents merely a rebranding of existing technologies [3], or heralds a genuine revolutionary shift. Indeed, the Metaverse, frequently addressed as the evolution of the internet [4] or an entirely immersive internet [5], could add an additional dimension to human experience or fall short of expectations and turn out to be an empty facade [6].

Although it is expected to further evolve in the coming years to adapt to society’s needs and expectations, its core attributes have been roughly identified: persistence, immersivity, massiveness, synchronicity, digital and real, economy, and interoperability [6]. Some scholars proposed also a model named “SPICE” that includes seamlessness, presence, interoperability, concurrence, and economic flow as general characteristics of the Metaverse [7].

There is some form of consensus over the fundamental technologies that should be involved in the Metaverse; in fact, the Metaverse is often associated with Blockchain and Cryptocurrency, Augmented (AR) and Virtual Reality (VR) [5], Artificial Intelligence (AI), and Internet of Things (IoT). Efficient real-time computation would be vital to provide an immersive experience based on multi-modal data [8], given the diverse data types which are foreseen to be utilized within the Metaverse [9] (e.g., visual, audio, textual, sensor, user interaction, network data and metadata [10]). The Metaverse is also expected to grow exponentially in terms of users, content, and interactions: in 2023, the World Economic Forum reported an expected customer base for the Metaverse of over 700 million users by the year 2030 [11].  

In the light of this, cloud computing might represent a likely and logical paradigm for the Metaverse, with its computing and storage resources [8] and ability to scale seamlessly. Cloud technologies encompass a broad range of services and infrastructures that provide on-demand access to computing resources, storage, and applications over the internet [12]. One of the key aspects of cloud technologies relevant to the Metaverse is scalability. Indeed, cloud computing is branded to offer elastic scalability, with the ability to dynamically allocate and adjust resources based on demand (see [13]). This might ensure that the infrastructure supporting the Metaverse will handle spikes in traffic and accommodate its expanding ecosystem [14] without compromising performance or reliability. Moreover, cloud technologies aim to provide flexibility and agility, which might enable rapid development, deployment, and iteration of Metaverse applications and services. Developers could leverage cloud-based tools and platforms to experiment, innovate, and iterate more quickly, accelerating the pace of Metaverse evolution.

Researchers have delved into the concept of crafting an appropriate architecture for Metaverse applications that would harness the capabilities of cloud technologies and have suggested a range of methodologies. For example, one such approach might involve a hierarchical cluster-based architecture, drawing on the stateless architecture principle of cloud-native applications and leveraging gossip protocols. In this model, each Metaverse application is assigned a dedicated cluster, optimized to ensure responsiveness and efficiency, with interactions between clusters facilitated by load balancers [15].

To explore possible interactions between cloud technologies and the Metaverse, this contribution aims to (1) outline the Metaverse requirements in line with prevailing expectations regarding its envisioned form and functionality, (2) illustrate what could be considered the most appropriate interaction between cloud technologies and the Metaverse, and finally (3) formulate conclusions to forecast potential outcomes and advancements. This research employs qualitative methods and establishes the framework for further investigation into the capability of current cloud providers in supporting the development of the Metaverse.

(in development...)

Friday, 4 October 2024

Generative AI Assisting Software Architecture Design for Video Games

Generative AI presents a promising avenue for revolutionising software architecture design processes in the video game industry. This study explores the potential of generative AI in designing software architecture tailored to the unique requirements of video game development. It examines how this technology impacts the software structure of digital entertainment products and identifies conditions for generative AI to become a standardized tool for this purpose.

To do so, this contribution firstly defines software architecture and its form in the context of video game development, then analyses the challenges of using generative AI to design architectural solutions for video games and finally proposes ways for a more functional interaction between generative AI and the Game Development Life Cycle (GDLC). This study closes with the proposal of an empirical methodology to further develop the research in this field.

Keywords—AI, Game Development, Generative AI, Software Architecture, Video Games

Photo by Ron Lach

I. INTRODUCTION

AI is poised to play an increasingly integral role in the evolution of video games in the coming years [1]. It is anticipated to substantially streamline and expedite the game development process while also enhancing the level of experience customisation available to players. AI is already used in game development to gather data, generate scenarios, game assets and non-player characters (NPC) [2], automate and test various pipeline components, or conduct sentiment analysis for players’ feedback [3]. New tools might arise to simplify processes, with financial and operational advantages for game studios. For example, game assets, which are frequently outsourced to third parties when there is the need of a high number of objects in a short amount of time, could be efficiently handled in-house; this might help art directors and supervisors in maintaining graphic and aesthetic consistency, reducing inter-company communications [4]. Budget constraints, especially for independent game developments, may encourage developers to adopt an in-house approach rather than subcontracting. However, employing full-time staff for bigger developments entails costs related to salaries, equipment, benefits, and workplace, which could become considerable [4]. Hence there is a need to carefully balance external, in-house and AI contributions. Further regulations are required if AI tools will be involved more consistently in this way, since these tools can be trained on copyrighted artworks [5].  

Video games represent a field where AI is tested in various forms, for example using Natural Language Processing (NLP) for text-based games [6]. New emerging AI trends in liminal areas of video gaming, such as cloud computing, blockchain, AR and VR [3], are evolving at a fast pace. One of these is generative AI. This study (1) explores the potential of generative AI in assisting game developers with designing an appropriate software architecture for video games. It (2) examines how this technology impacts the software structure of digital entertainment products and (3) identifies the necessary conditions for generative AI to become a standardized tool for this purpose.

The exploration of whether generative AI will emerge as a standardised approach to software architecture design in the realm of video games holds profound implications for the future trajectory of the gaming industry. In fact, it underscores the transformative potential of AI in reshaping how games are conceptualised, developed, and experienced by players [7].

II. SOFTWARE ARCHITECTURES FOR VIDEO GAMES

The ISO/IEC 42010 standard establishes a framework for describing the architecture of systems and offers guidelines and principles for creating architecture descriptions that can be applied in various contexts [8]. Through architectural descriptions and specifications, software developers and architects can design, develop, validate, and evolve systems at a higher-level of abstraction while preserving system quality and functionality [9]. Software architecture is a functional partition of a whole into smaller parts that maintain specific relations among themselves; each partition is the result of a careful design process which is carried out to satisfy the driving quality attribute requirements and the central business objectives behind the system [10].

In defining a software architecture, it is noteworthy to differentiate large organisations vs small teams of developers [11]; in the game industry, these two scenarios can be representative of two specific video game productions known as triple-A (AAA) and independent (indie). AAA is used in the game industry to refer to the product made by a medium-large development company; this requires a meaningful budget for its development [12] and can entail complex software architectures due to their large scale and scope, post-launch support and updates, optimisation for various platforms etc. Indie usually refers to individuals or small teams of developers without the financial or logistical assistance of a large publisher. It must be noted that video game production also includes part-time hobbyists, aspirational students, client-facing contractors, independents, and artist collectives [13] who respond to diverse business objectives. Hence, video game software architectures significantly vary from one project to another and cannot be rigidly standardised.

Because of this, there is no consensus over a standard video game software architecture or software architecture design process. A massive multiplayer online video game (MMO) that requires updates and constant interaction with other players [14] has different requirements from a single-player video game which typically has a predefined storyline or set of objectives that players can complete on their own. For example, in MMOs, conversely to single-player video games, it is essential to oversee certain security requirements, like providing protection against application-layer DDoS attacks that exploit in-game dependencies to cause massive spikes in bandwidth [15].

A systematic literature review of software engineering for industry-scale computer games [16] reveals that video games are unique in terms of size, complexity, and creativity, in comparison to traditional software engineering. The study asserts that commonalities between traditional software development and game development are mainly in the project management and the impact of commercial requirements over the design decisions [16]. The differences emerges from the analysis of the peculiar features of game development: for instance, its multidisciplinary nature, the emphasis on subjective player experience, the highly iterative process and non-agile methodology, the fixed deadlines, the management of a large amount of assets, the complex testing phase, the incorporation of post-release additions, the management of various software systems, and the utilization of highly specialized middleware – like game engines – that have democratized the process for developers without an engineering background [16].

A debated argument around software architectures for video games is the choice between monolithic and microservices architectures [17] which highlights important decisions and trade-offs that development teams must consider for their product [18]. Monoliths are designed, developed, and deployed as a single unit while microservices refer to a collection of loosely coupled and independently developed, deployed, and scaled services [19]. Microservice architecture tends to be cloud-native architecture [20]. In the context of video games, there is no consensus on adopting one approach over the other one and indeed there are cases where both are involved. A small development team with a small codebase size and concerns about performance might adopt a monolithic architecture for a video game with a non-exponential evolution and a singular deployment. An MMO might use a traditional client-server model [21] with some functionalities implemented within a microservice architecture. This approach is particularly effective when game services require constant updates in real time, new functionalities to build and maintain, faults to isolate and fix [22], and a substantial number of users scattered in various geographical locations that might peak. However, as advantageous as it might appear, this might also bring additional overhead over a monolithic approach. Attention must also be given to the communication between the components of the architecture; in microservice architecture, components communicate between themselves using a lightweight convention such as HTTP and an application programming interface (API) contract [23]; in monolithic architectures, data tends to be kept on the same machine. Monolithic architectures are unified, with all their functions managed and served in one place [18]; monolithic applications tend to excel in low latency due to local execution [17] and thus might increase the performance of the game.

A fitting solution for game developers in the context of online games is represented by a hybrid solution [17]. It must also be noted that migration from monolithic to microservices architecture might be possible [24] if the need arises. In consideration of this, it becomes apparent that, within the contemporary game industry, no predetermined architectural framework can perfectly align with every business requirement.

Photo by Francesco Ungaro

III. GENERATIVE AI AND VIDEO GAMES SOFTWARE ARCHITECTURE

Generative AI refers to a technology that produces content based on a given prompt [25]. This technology can generate various forms of output, including text, images, and other media, in accordance with the instructions provided. Generative AI has been extensively researched in recent years, with various studies identifying a large growth in adopting tools such as ChatGPT and Midjourney in several domains, including healthcare, business, the military, and design [26]. Research has also explored generative AI in the context of designing system architectures, with numerous contributions from experts in the industry.

This study [27] highlighted that design decisions and assumptions made in the design process for software architectures require a familiarity with the context. Architectural knowledge and the ability to make meaningful compromises are skills which imply the experience of having seen similar scenarios over different situations [27]. Practical expertise is fundamental in crafting appropriate prompts that would guide generative AI tools in designing software architectures. In the light of this, the prompt engineer interacting with the generative AI should have extensive knowledge of related systems and be aware of the context and trade-offs for that specific product requiring an architectural solution. This is also essential to correctly interpret the output and avoid hallucinations, meant as the phenomenon in which generative AI software systems produce fabricated or false information [28]. It has been proven that, although generative AI is trained on large amounts of data, it might struggle to provide accurate responses to questions that require practical knowledge or experience, up-to-date technology, and context understanding [29]. This might be problematic for the purpose of establishing suitable software architectures for complex products such as video games.

As previously stated, video game and traditional software development share some commonalities such as the impact of commercial requirements over the design decision. The system/software development life cycle (SDLC), meant as a series of stages within the methodology that are followed in the process of developing and revising an information system or software, establishes segments for the development which are usually completed using software development tools [30]. In the context of video games, some scholar has theorised a more specific game development life cycle (GDLC) which consists of an initiation, pre-production, production, testing and release stage [31], with other experts theorising an additional step such as the beta stage [32]. Considering that several game developers have proposed their own GDLC on the internet, it can be reasonably claimed that there is no univocal solution to the establishment of a procedural pipeline for all video games. Therefore, to efficiently prioritize specific requirements or constraints in a video game development workflow, generative AI aiming to support game development must be trained on diverse and factual GDLC models that are relevant to existing game architectures. Gaining exposure to comparable scenarios subject to multiple conditions, coupled with an assessment of the advantages and disadvantages of the adopted architectural solutions in each situation, would enhance architectural knowledge and foster a more streamlined decision-making process for the game developer.

To create suitable software architectures, generative AI also requires specific information on the desired quality attributes such as performance, reliability, security, and modifiability. Taking traditional software architecture as an example, if the emphasis is on high performance, generative AI might suggest exploiting potential parallelism by decomposing the work into synchronising or cooperating processes, manage the network and interprocess data access frequencies and communication volume, identify performance bottlenecks, and be able to evaluate predictable latencies and throughputs [10]. The establishment of detailed quality attributes for video games is equally important, but it necessitates additional parameters that can be extrapolated by the client brief, the game design document (GDD) and/or other pre-production documents. For instance, parameters might include requisites such as the use of a specific engine for graphics, for sound/audio, for rendering, or explicit input/output (I/O) units; these can also describe other requirements related to the context of the game, the target audience, the game genre and similar. These parameters, along with the specification of quality attributes, should be formulated as a functional prompt which serves as the input. The goal is to receive a video game software architecture output from generative AI that requires minimal modifications from the development team.

This approach to the software architecture design process does not influence the game development in its core components like the game design or the asset creation, but rather in the structuring of the system supporting them, and in the flow and economy of the development process. However, a more systematic approach to design system architectures for video games through generative AI can only be theorised since research and industrial practice have shown a lack of consistency in its current implementation.

IV. CONCLUSION

Generative AI holds significant promise for informing video game software architecture design, potentially streamlining development processes and optimising workflows. However, there is no standardised utilisation in the game industry due to various challenges in consistency and implementation. Despite these challenges, the transformative impact of AI on game development is evident in several predictable aspects, and it might signal a shift in how games might be conceptualised, developed, and experienced by players in the near future.

This initial investigation lays the groundwork for further exploration into the capabilities of generative AI tools for providing software architectural suggestions. Experiments could be designed to assess the potential of these tools (e.g., ChatGPT) in offering diverse solutions for theoretical video game projects with varying requirements. The output generated by such tools can then be marked and catalogued according to predefined criteria for analysis, with the aim of evaluating the current capabilities of generative AI in designing software architectures for video games.

References

[1] Y. Wu, A. Yi, C. Ma, L. Chen, "Artificial intelligence for video game visualization, advancements, benefits and challenges," Mathematical Biosciences and Engineering, vol. 20, no. 8, pp. 15345-15373, 2023, doi: 10.3934/mbe.2023686.

[2] L. J. Gunawan, B. N. Marlim, N. E. Sutrisno, R. Yulistiani, and F. Purnomo, "Analyzing AI and the impact in video games," in 2022 4th International Conference on Cybernetics and Intelligent System (ICORIS), Prapat, Indonesia, 2022, pp. 1-4, doi: 10.1109/ICORIS56080.2022.10031590.

[3] S. Srivastava, "How AI in gaming propelling the industry into a new epoch," Appinventive, [Online]. Available: https://appinventiv.com/blog/ai-in-gaming/#:~:text=Looking%20ahead%2C%20AI%20will%20play,to%20monetize%20their%20gaming%20platforms (accessed: Mar. 22, 2024).

[4] Juegoadmin, “How to outsource game art: a comprehensive guide,” Juego Studios, [Online]. Available: https://www.juegostudio.com/blog/how-to-outsource-game-art (accessed: Mar. 29, 2024).

[5] J. G. Gatto, "Video Games," Licensing Journal, vol. 43, no. 8, pp. 26-27, 2023.

[6] T. Gao, J. Li, and Q. Mi, "From game AI to metaverse AI: realistic simulation training as a new development direction for game artificial intelligence," in 2023 International Conference on Emerging Techniques in Computational Intelligence (ICETCI), Hyderabad, India, 2023, pp. 130-137, doi: 10.1109/ICETCI58599.2023.10331190.

[7] A. Christofferson, A. James, T. Rowland, and I. Rey, "How will generative AI change the video game Industry?" Bain & Company, Sep. 14, 2023, [Online]. Available: https://www.bain.com/insights/how-will-generative-ai-change-the-video-game-industry (accessed: Mar. 29, 2024).

[8] ISO/IEC/IEEE, "Systems and software engineering–architecture description," ISO/IEC 42010, Tech. Rep., Dec. 2011.

[9] A. A. Khan, A. A., M. Waseem, P. Liang, M. Fahmideh, T. Mikkonen, and P. Abrahamsson, "Software architecture for quantum computing systems — A systematic review," Journal of Systems and Software, vol. 201, p. 111682, 2023, doi: 10.1016/j.jss.2023.111682.

[10] P. Clements et al., Documenting Software Architectures: Views and Beyond, 2nd ed. Boston, MA, USA: Addison-Wesley Professional. 2010.

[11] C. Hofmeister, P. Kruchten, R. L. Nord, H. Obbink, A. Ran, and P. America, "A general model of software architecture design derived from five industrial approaches," Journal of Systems and Software, vol. 80, no. 1, pp. 106-126, 2007, doi: 10.1016/j.jss.2006.05.024.

[12] G. Balla, "Adapting visual references in concept art for films and video games in design uncanny monsters," Journal of Adaptation in Film & Performance, vol. 16, no. 1, pp. 133-145, 2023, doi: 10.1386/jafp_00093_1.

[13] B. Keogh, The Videogame Industry Does Not Exist: Why We Should Think Beyond Commercial Game Production. The MIT Press, 2023, doi: 10.7551/mitpress/14513.001.0001. ISBN: 9780262374132.

[14] F. Lu, S. E. Parkin, and G. Morgan, "Load balancing for massively multiplayer online games," in Proceedings of the 5th Workshop on Network and System Support for Games, NETGAMES 2006, Singapore, Oct. 30-31, 2006, doi: 10.1145/1230040.1230064.

[15] N. Gavrić and Ž. Bojović, "Security concerns in MMO games-Analysis of a potent application layer DDoS threat," Sensors (Basel), vol. 22, no. 20, pp. 7791, 2022, doi: 10.3390/s22207791.

[16] J. Chueca, J. Verón, J. Font, F. Pérez, and C. Cetina, "The consolidation of game software engineering: A systematic literature review of software engineering for industry-scale computer games," Information and Software Technology, vol. 165, p. 107330, 2024, ISSN 0950-5849, doi: 10.1016/j.infsof.2023.107330.

[17] Ascendion, "Monoliths vs microservices in gaming architecture: striking the right balance," Ascendion Blog, [Online]. Available: https://ascendion.com/blog/monoliths-vs-microservices-in-gaming-architecture-striking-the-right-balance (accessed: Mar. 29, 2024).

[18] M. Beznos, "Microservices vs monolith: which architecture is the best choice for your business?" N-iX, Jan. 03, 2023, [Online]. Available: https://www.n-ix.com/microservices-vs-monolith-which-architecture-best-choice-your-business/ (accessed: Mar. 29, 2024).

[19] Z. Tan, "Appendix A. monoliths vs. microservices," in Acing the System Design Interview. United States: Manning Publications Co. LLC, 2024.

[20] A. Balalaie et al., "Microservices migration patterns," Software: Practice and Experience, vol. 48, no. 11, pp. 2019-2042, 2018, doi: 10.1002/spe.2608.

[21] Kim, H.Y., & Park, H.J. (2013). "An efficient gaming user oriented load balancing scheme for MMORPGs," Wireless Personal Communications, vol. 73, pp. 289-297, doi: 10.1007/s11277-013-1237-2.

[22] Hanson, J., "Why you should run your game servers independently from your chat," FreeCodeCamp, Apr. 11, 2018, [Online]. Available: https://www.freecodecamp.org/news/why-you-should-run-your-game-servers-independently-from-your-chat-3263b4b9548e/ (accessed: Apr. 20, 2024).

[23] A. Razzaq, S. A. K. Ghayyur, "A systematic mapping study: the new age of software architecture from monolithic to microservice architecture—awareness and challenges," Computer Applications in Engineering Education, vol. 31, no. 2, pp. 421-451, 2022, doi: 10.1002/cae.22586.

[24] S. Newman, Monolith to Microservices. O'Reilly Media, Inc., 2019.

[25] Lim, W.M., Gunasekara, A., Pallant, J.L., Pallant, J.I., & Pechenkina, E. (2023). "Generative AI and the future of education: Ragnarök or reformation? A paradoxical perspective from management educators," The International Journal of Management Education, vol. 21, no. 2, p. 100790, doi: 10.1016/j.ijme.2023.100790.

[26] David, Y., Krebs, A., & Rosenbaum, A. (2023). "The use of generative AI tools in design thinking academic makeathon," CERN IdeaSquare Journal of Experimental Innovation, vol. 7, no. 3, pp. 43-49, doi: 10.23726/cij.2023.1470.

[27] Ozkaya, I., "Can architecture knowledge guide software development with generative AI?," IEEE Software, vol. 40, no. 5, pp. 4-8, 2023, doi: 10.1109/MS.2023.3306641.

[28] J. Christensen, J. M. Hansen, and P. Wilson, "Understanding the role and impact of generative artificial intelligence (AI) hallucination within consumers’ tourism decision-making processes," Current Issues in Tourism, pp. 1-16, 2024, doi: 10.1080/13683500.2023.2300032.

[29] G. Menzel, "ChatGPT – the solution architect of the future?" LinkedIn, Mar. 13, 2023, [Online]. Available: https://www.linkedin.com/pulse/chatgpt-solution-architect-future-gunnar-menzel (accessed: Apr. 22, 2024).

[30] G. D. Everett and R. McLeod, Software Testing: Testing Across the Entire Software Development Life Cycle. Hoboken, NJ: John Wiley and Sons, Inc., 2007.

[31] M. S. Sulaiman, M. H. I. Jamaludin, and Z. Derasit, "Code cody: A game-based learning platform for programming education," Journal of ICT in Education, vol. 10, no. 1, pp. 79-91, 2023, doi: 10.37134/jictie.vol10.1.7.2023.

[32] R. Ramadan and Y. Widyani, "Game development life cycle guidelines," 2013 International Conference on Advanced Computer Science and Information Systems (ICACSIS), Sanur Bali, Indonesia, 2013, pp. 95-100, doi: 10.1109/ICACSIS.2013.6761558.

Wednesday, 1 May 2024

Dockerizing Python Apps on Windows

Docker is a popular tool in software development and deployment workflows released in 2013. It is a platform that uses OS-level virtualization* to deliver software in packages called containers.

*(a form of virtualization where the operating system kernel allows the existence of multiple isolated user space instances, called containers, to run concurrently on a single host operating system. It shares the host operating system's kernel among the containers, conversely to traditional virtualization where each virtual machine (VM) runs its own separate operating system. For this reason, containers are typically faster to start up and use less memory!).

Docker is used for developing, shipping, and running applications. It utilizes containerization technology to package applications and their dependencies into standardized units called containers which run the application in isolation, away from other processes on the host machine. These containers encapsulate everything needed to run the application, including the code, runtime, libraries, and system tools, ensuring that the application behaves consistently across different environments.

Let’s imagine being part of a development team working on a Node.js application with very specific version requirements. This application needs to be shared with another developer on the team who must run it on their computer. To ensure it runs correctly, they need to set up their development environment to match mine. This involves installing the same version of Node.js, all project dependencies, and configurations such as environment variables. The setup is significant and should be applied to any machine running the same application. Docker and containers were developed to solve this problem.
 
-------------------------------------------------------------------
OBJECTIVE

In this post, I will illustrate how to (1) install Docker on Windows, (2) create an image for a simple Python application, and (3) run the image. 


THE APPLICATION

When given a name, this Python application outputs a tailored greeting message.

def greeting (name):
    phrase = 'Hello, ' + name + '!'
    return phrase    

if __name__ == '__main__':
    name = input('What is your name? ')
    print(greeting(name))

This Python file, called greeting.py, is saved in a folder that I specifically created for this exercise.


INSTALL DOCKER DESKTOP ON WINDOWS

To do this, Docker Desktop should be installed. I am using Windows, so its installation is trickier than the installation on a computer which already has a Linux distribution.

The reason for this is ignored in this post but it might be the subject for another post.

This page contains the download URL, information about system requirements, and instructions on how to install Docker Desktop for Windows. Basically, to run Docker, I have to run a full Linux environment on Windows without a virtual machine. For this, WSL, which is a Windows subsystem for Linux, can be used. To install WSL, instructions can be found here
 
 
DOCKER IMAGES

Docker images are blueprints (read-only) for containers. They are essentially a snapshot of a filesystem that includes everything needed to run an application: the application code, runtime environment, libraries, dependencies, and any additional configurations or commands required. 
 
Once a Docker image is created, it cannot be modified; instead, it must be recreated. When you run a Docker image, a container is created based on that image. Images can typically be shared without significant worries regarding compatibility.

Docker images are organised in layers. Generally, the first layer is the parent image which includes a lightweight OS and a runtime environment. Parent images for Docker can be found in a public repository called Docker Hub. Here we have a list of parent images to choose from and "pull" (download).


DOCKERFILE

A Dockerfile is a text file that contains a set of instructions used to build a Docker image. These instructions specify the steps needed to create a Docker image, including setting up the environment, installing dependencies, copying files into the image, and configuring the container's behaviour.

Each instruction in a Dockerfile roughly translates to an image layer. The order of Dockerfile instructions matters.

How a Dockerfile translates into a stack of layers in a container image (docker.docs).

In the folder where my Python application is, I create a file called "Dockerfile", with the capital "D" and no extension (I use Visual Studio Code with the Docker package installed). A list of commands that can be used in a Dockerfile can be found here.

The Dockerfile for my Python application contains:

# Define the structure of the Docker image. 
# Start from the top.
  
# Use a Python runtime as the base image.
# Found on Docker Hub.
FROM python:3.12-alpine

# Set working directory in the container (app).
# Commands are now executed relative to this dir.  
WORKDIR /app

# Copy the current dir contents into /app.
# First . ->Files in the dir where the Dockerfile is.
    # Source directory (host machine). 
# Second . ->Install files in /app.
    # Destination directory (container).  
COPY . .

# Run the application when the container starts.
CMD ["python", "greeting.py"]

 

DOCKER BUILD

The docker build command compiles the instructions from the Dockerfile to create the Docker image. 

I make sure that Docker Desktop is running on my computer. 

In the same directory where the Dockerfile is, in the terminal, I type docker build -t name_of_the_app .

-t is a flag used to give a name and a tag to the image (tag is "latest" if not specified).

. is the relative path to the Dockerfile (I am already in that directory).

This creates the Docker image which can be found in the Docker Desktop under "Images". From there, I can select the image and run a new container. Then I can select that container and start it.

However, starting the container does not launch the Python application. In fact, under "Logs" for that specific container in the Docker Desktop, I found an EOFError: EOF related to the part of the code which asks for an input (the user's name). In the context of running a Docker container, this error may occur if there is no interactive terminal available for the container to accept user input. When running a Docker container, the default behaviour is non-interactive, meaning it does not allow for interactive input from the user. The container for this image must be recreated. Read down on how to solve this.


DOCKER RUN VIA CLI

docker images -> list all available images.

docker run -it --name container_1 name_of_the_app -> to run a container named "container1" from the "name_of_the_app" image.

-it is used to

  • allocate a pseudo-TTY which enables terminal-like features such as displaying output and accepting input (t).
  • enable interactivity (i). Indeed, the "-i" flag instructs Docker to attach STDIN for the container, allowing me to interact with it. I required the user to insert a name as the input for the Python application so interactivity is needed. This solves  the EOFError related to the input.

With this, the Python application runs on the terminal no problem as soon as I create the container. If I want to run it again, I need to re-start the container.

docker ps -> list all running containers.

docker ps -a -> list all containers.

docker stop container_1 -> to stop "container_1".

docker start container_1 -> to start a "container_1" which was stopped.

In my case, when I start the container again, I need to make it interactive, so I have to type:  

docker start -i container_1

No need to enable terminal-like features with the "-t" flag again, since these features have been embedded in the container when I first created it through the CLI.    

However, stopping and restarting a container to run an application which is on it is not functional because it would reset the container's state, potentially losing any changes made during the container's previous execution.

Alternatively, I can use

docker exec -it container_1 python greeting.py 

to execute a command inside a running container without restarting it. Now, when my container is running, I can execute the Python application every time I want!

In the writing of this post, I ignored .dockerignore and Volumes, which might become the subject for another post.

Integration of Cloud Technologies with the Metaverse

The potential impact and timeline for the development of the Metaverse remain uncertain, with ongoing debate over whether it represents a me...