This project demonstrates creating a custom Docker image with an Nginx server, running it in a Docker container, and deploying it on AWS Elastic Beanstalk for scalable and efficient web hosting.
This project utilizes Docker for containerization and AWS Elastic Beanstalk (EBS) for deployment. Elastic Beanstalk simplifies deploying and managing applications in the cloud without the need for managing infrastructure.
- Docker Desktop (Docker Desktop or native CLI tools)
- An active AWS account with permissions for Elastic Beanstalk.
- Basic knowledge of Docker and AWS Elastic Beanstalk.
-The Dockerfile serves as the instruction set to build a container image. It:
- Pulls the base Nginx image.
- Replaces the default
index.htmlfile with a custom one. - Exposes the web server to receive HTTP traffic.
# Dockerfile
FROM nginx:latest
COPY index.html /usr/share/nginx/html/index.html
EXPOSE 80-Use the following command to build your custom image:
-sudo docker build -t my-web-app .
-The specifies the current directory containing the Dockerfile.
-Run the container to verify functionality: -sudo docker run -d -p 8080:80 my-web-app
-Access the application locally by navigating to http://localhost:8080.
- Package the application: Create a
.zipfile containing theDockerfileandindex.html. - Deploy on EBS:
- Create a new Elastic Beanstalk application in the AWS Management Console.
- Upload the
.zipfile. - Deploy the application.
- Key Learning: Deploying containers on AWS EBS is straightforward and efficient for web applications.