{"id":18564960,"url":"https://github.com/sumitm01/containerization-of-a-microservice-application","last_synced_at":"2026-04-16T12:40:38.086Z","repository":{"id":180905802,"uuid":"665818701","full_name":"SumitM01/Containerization-of-a-microservice-application","owner":"SumitM01","description":"This project contains the documentation of the implementation details for the containerizing an existing micro services application using Docker and publishing the images on Dockerhub.","archived":false,"fork":false,"pushed_at":"2023-07-15T11:37:55.000Z","size":2388,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-12-26T12:09:58.169Z","etag":null,"topics":["containerization","dbms","docker-cli","docker-compose","docker-engine","dockerhub","java","maven","memcached","nginx","rabbitmq","tomcat"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SumitM01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2023-07-13T04:35:56.000Z","updated_at":"2023-07-25T11:24:08.000Z","dependencies_parsed_at":"2023-07-13T09:36:00.144Z","dependency_job_id":"bdecddb5-4d96-42ba-b0d7-dc2ea57640e8","html_url":"https://github.com/SumitM01/Containerization-of-a-microservice-application","commit_stats":null,"previous_names":["sumitm01/containerization-of-a-microservice-application"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SumitM01%2FContainerization-of-a-microservice-application","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SumitM01%2FContainerization-of-a-microservice-application/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SumitM01%2FContainerization-of-a-microservice-application/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SumitM01%2FContainerization-of-a-microservice-application/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SumitM01","download_url":"https://codeload.github.com/SumitM01/Containerization-of-a-microservice-application/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239293948,"owners_count":19615043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["containerization","dbms","docker-cli","docker-compose","docker-engine","dockerhub","java","maven","memcached","nginx","rabbitmq","tomcat"],"created_at":"2024-11-06T22:16:57.048Z","updated_at":"2026-04-16T12:40:33.061Z","avatar_url":"https://github.com/SumitM01.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Containerization-of-a-microservice-application\nThis project contains the documentation of the implementation details for the containerizing an existing micro services application using Docker and publishing the images on Dockerhub.\n\n## Overview\nThe project aims to address the **challenges** faced by operations or DevOps teams managing **multi-tier application stacks** running on various platforms, including VMs, cloud environments like AWS, or physical machines in a data center. These challenges include **high costs, resource wastage, human errors** during deployment, and **lack of synchronization across different environments**. The proposed solution is to **containerize** the application, which can **save money** by using fewer resources, make deployments more **reliable** through the use of container images, and improve **portability** and **reusability** across environments. This approach is particularly suitable for **microservice architecture**. By containerizing the application, the team can achieve **significant benefits** and improve their operations.\n\n## Services Used\n- AWS EC2\n- Dockerhub\n- Docker Engine\n- Github\n\n## Implementation Details\n\n### Create Repositories on Dockerhub\n**On Dockerhub**\n- Go to *Repositories-\u003eCreate repository*-\u003e Give a name and create.\n- In this way create 3 public repositories to host app, db and web images.\n![Dockerhub-repos](https://github.com/SumitM01/Containerization-of-a-microservice-application/assets/65524561/f3b910b4-3945-499e-b5ad-19b38332943b)\n\n### Configure EC2 instance and Docker engine\n- Launch an EC2 instance with the following specifications:\n    - Instance type: t2.small/t2.medium (higher RAM is required for proper functioning of docker engine)\n    - AMI: Ubuntu 22\n    - Security Group inbound rules : \n        - port 22 allowed from your IP\n        - port 80 allowed from your IP.\n    - User data content:\n    ```bash\n    #!/bin/bash\n    sudo apt-get update\n    sudo apt-get install ca-certificates curl gnupg -y\n    sudo install -m 0755 -d /etc/apt/keyrings\n    curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg -y\n    sudo chmod a+r /etc/apt/keyrings/docker.gpg\n    echo \\\n    \"deb [arch=\"$(dpkg --print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \\\n    \"$(. /etc/os-release \u0026\u0026 echo \"$VERSION_CODENAME\")\" stable\" | \\\n    sudo tee /etc/apt/sources.list.d/docker.list \u003e /dev/null\n    sudo apt-get update\n    sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y\n    ```\n    - This will install docker engine on your instance while it is being launched.\n  ![ec2-instance](https://github.com/SumitM01/Containerization-of-a-microservice-application/assets/65524561/cacfe775-57bb-4c59-99b3-186814f0c238)\n\n### Fork vprofile-project repository into your account\n- **On Github**\n- Fork the vprofile-project repository with the same name into your account.\n- Switch to branch containers which contains empty docker files which you can edit.\n\n### Write dockerfiles to customize images\n- Clone this repository into your machine.\n- Switch to branch containers using the command\n```bash \ngit checkout containers\n```\n- Then edit the following:\n    - Insert contents into Docker-files/db/Dockerfile from the https://github.com/SumitM01/vprofile-project/blob/containers/Docker-files/db/Dockerfile file.\n    - Insert contents into Docker-files/web/Dockerfile from the https://github.com/SumitM01/vprofile-project/blob/containers/Docker-files/web/Dockerfile file.\n    - Insert contents into Docker-files/app/Dockerfile from the https://github.com/SumitM01/vprofile-project/blob/containers/Docker-files/app/Dockerfile file.\n    - Insert the contents into Docker-compose.yaml file from https://github.com/SumitM01/vprofile-project/blob/containers/docker-compose.yml file.\n- Commit and push the changes into the remote repository.\n\n### Run the files and upload images to Dockerhub\n- ssh to the ec2 instance.\n- Clone the remote repository from github.\n- Switch to containers branch.\n- Validate the changes made.\n- Run the following command to build the images:\n```bash\ndocker compose build\n```\n- Run the following command to see the built images:\n```bash\ndocker images\n```\n![docker-images](https://github.com/SumitM01/Containerization-of-a-microservice-application/assets/65524561/a1406385-7359-49f3-8854-ac40cbbce7b0)\n\n- Run the following command to spin up all the containers from the images in the background:\n```bash\ndocker compose up -d\n```\n![Docker-compose-up](https://github.com/SumitM01/Containerization-of-a-microservice-application/assets/65524561/cd0de36a-08d1-430a-800b-489eeebd606e)\n\n- Run the following command to login to Dockerhub\n```bash\ndocker login\n```\n    - Provide username and password to login.\n- Run the following command to upload images to dockerhub:\n```bash\ndocker push your_account_name/repository_name\n```\n- Logout from docker hub using \n```bash\ndocker logout\n```\n### Stop the containers and clean up\n- After validation and uploading is completed perform the following commands to clean up:\n```bash\ndocker compose down\ndocker system prune -y\n```\n\n## Results\nAs the containers are deployed, I validated them by visiting the following pages:\n- **Login Page**\n![login-page](https://github.com/SumitM01/Containerization-of-a-microservice-application/assets/65524561/96b6ded1-209b-493e-9e5b-eae1386eff18)\n\n- **Home Page**\n![home-page](https://github.com/SumitM01/CI-CD-project-using-AWS-CodeCommit/assets/65524561/b3dade74-61d4-4867-9938-46eedf123423)\n\nHere we can see that the backend services RDS, Elasticache and RabbitMQ are also configured correctly.\n- **User list page**\n![database-users-page](https://github.com/SumitM01/Containerization-of-a-microservice-application/assets/65524561/a7184c72-f762-4faf-a47b-0385b180d879)\n- **Database Validation**\n![db-validation](https://github.com/SumitM01/Containerization-of-a-microservice-application/assets/65524561/967d1f54-1d42-4f86-b6bf-d651d8b0dfa3)\n- **Rabbitmq status**\n![rabbitmq-start-success](https://github.com/SumitM01/CI-CD-project-using-AWS-CodeCommit/assets/65524561/c600d583-18e2-4daf-845c-39febf678ab3)\n- **Memcache Validation**\n![cache-validation](https://github.com/SumitM01/Containerization-of-a-microservice-application/assets/65524561/3a666edd-26f4-46d2-b5ee-a2393466004a)\n\n## Conclusion\nTo conclude, the project provides a cost efficient way to manage infrastructure by using containers to host applications. I have successfully conatinerized the existing application using docker and uploaded the images\nto dockerhub for your viewing.\nAs documented in this markdown format file, I have invested a significant amount of time in researching, learning, debugging to implement this project. If you appreciate this document please share with friends and do give it a try. \n## References\n- https://www.udemy.com/course/decodingdevops\n- https://github.com/devopshydclub/vprofile-project/tree/docker\n- https://docs.docker.com\n- https://hub.docker.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsumitm01%2Fcontainerization-of-a-microservice-application","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsumitm01%2Fcontainerization-of-a-microservice-application","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsumitm01%2Fcontainerization-of-a-microservice-application/lists"}