Objective:
To install and manage docker containers using portainer on an AWS EC2 instance, integrate GitHub Actions for CICD and deploy a Dockerized web application (Medplus) to AWS ECR
Architecture Components
- AWS Ec2: Hosts Docker and Portainer
- Portainer CE: Web UI for Docker container management
- Amazon ECR: Stores container images
- GitHub Actions: Automates build and push to ECR
- IAM Roles and secrets: Used for secure authentication
- Dockerfile: Defines the build process for the mediplus app
Step 1: Launch an EC2 Instance
- Log in to AWS Console
- Navigate to EC2- Launch Instance
- Choose Ubuntu, create a new key pair
- In security group, open these ports: 22-SSH, 9443- Portainer dashboard, 8000- Portainer agent, 80- web server
- Launch the instance and connect to mobaxterm using your public ip address
Step 2: Install docker
On your mobaxterm, input the following command:
sudo apt update
sudo apt upgrade
sudo apt install docker.io