Packing Applications with Docker Containers

Akram Rayri
2 min readSep 11, 2023

--

No one can deny the crucial role that containers are playing in the modern cloud infrastructure nowadays, since we can create hundreds of them on only few virtual machines. Docker containers, for instance can host several services from different scopes. In this project I will focus more on Docker Compose, which is a utility from Docker that brings automation to the container layer from the cloud stack.

The two figures above, are illustrating two different applications hosted on two different containers. The first one is a WordPress application server where a user can populate with his own data, that is connected to another container that hosts a MySQL database in the back-end. The second application is a Python based one, where it’s simply allowing the user to upload files, documents, images to the Docker host machine.

Since we already know that containers have ephemeral storage, we have leveraged containers volumes and bind-mounts to persist data after deletion of these containers. Networking was also another topic to deal with, since we had to create custom bridge networks in order to make containers isolated and in two different “worlds” so that we are insuring security best practices.

The novelty of this infrastructure implementation is the fact that we utilized Docker Compose plugin, which is a YAML file that could be written depending on which Docker Compose version we want to use. For this project, I have written the YAML file in the last version which is version “3” that supports many other services rather than the last two versions, especially the Docker Swarm support.

While constructing the automation YAML file, we have implemented services (container names, images, ports, environment variables…), volumes (where data will persist, it’s like a virtual storage residing on the docker host machine) then networks (which essential component to make containers talk to each other, especially in the isolation case).

By that, we have provisioned multiple Docker containers hosting multiple application, and residing in different networks in few seconds and in automated way.

--

--

Akram Rayri

ICT Consultant and Engineer with focus on Cloud & DevOps | AWS | Microsoft Azure | Google Cloud | Oracle Cloud