App Deployment

Deploy Application Using Container

Docker is a software platform that allows you to quickly build, test, and deploy applications. Docker packages software into standardized units called containers that have everything the software needs to run, including libraries, system tools, code, and runtimes. Using Docker, you can quickly deploy and scale your application into any environment and know with certainty that your code will run. Running Docker on AWS gives developers and administrators a low-cost and highly reliable way to build, ship, and run distributed applications of any size.

Docker partners with AWS to help developers quickly bring modern applications to the cloud. This partnership helps developers using Docker Compose and Docker Desktop to leverage the same local workflows they use today to seamlessly deploy applications on Amazon ECS and AWS Fargate. Read the blog for more information.

Docker works by providing a standard method for running your code. Docker is an operating system for containers. In the same way that a virtual machine virtualizes (eliminating the need to directly manage) server hardware, containers virtualize the host’s operating system. Docker is installed on each host and provides simple commands that you can use to build, start, or stop containers.

AWS services like AWS Fargate, Amazon ECS, Amazon EKS, and AWS Batch make it easy to run Docker containers at scale.

LAB-ECR-Docker

  1. Install Docker Engine package
sudo amazon-linux-extras install docker

LAB-ECR-Docker

  1. Start Docker Service
sudo service docker start
  • Add ec2-user to docker group
sudo usermod -a -G docker ec2-user
  • Verify Docker installation on an EC2 instance is successful

LAB-ECR-Docker

  1. Install git
sudo yum install git

LAB-ECR-Docker

  1. Create a new Git repository (Git Repo)
git init

Then, clone the repository.

git clone https://github.com/AWS-First-Cloud-Journey/AWS-FCJ-Management.git

LAB-ECR-Docker

  1. Make a file .env to configure the database.
touch .env
en.env

In the file .env proceed to configure

DB_HOST= "Endpoint RDS
DB_NAME= "db name"
DB_USER= "db user"
DB_PASS="db password"

LAB-ECR-Docker

  1. Execute file view docker-run.sh
cat docker-run.sh

LAB-ECR-Docker

  1. Implement permissions and use the docker-run.sh file to deploy the application.
chmod +x docker-run.sh

Application Deployment:

./docker-run.sh

LAB-ECR-Docker

  1. Use IP Public of EC2 instance and check in browser, application running on port 5000

LAB-ECR-Docker

  1. Successful application deployment.

LAB-ECR-Docker