Dockerfile:
A Dockerfile is a text file that contains a set of instructions for building a Docker image. These instructions specify the environment and dependencies required for running an application or service.
Project Details:
The objective of this project is to set up a Dockerized web hosting environment on AWS. A separate EC2 instance is created for running a Docker container that hosts the website using a Docker image
Launch an EC2 instance and install docker into it.
sudo apt-get install docker.io
Step 1: git clone to your app
Step 2: Check the requirements.txt
Step 3: write the docker file according to project requirements.
step 4: build the image
step 5: run the image and create the container
step 6: go to your AWS security inbound group and enable port 8001
according to your project, you enable your port
this is written in requirements.txt
step 7: and then open a new tab and paste your IP(public) for your instance and then your port according to this picture and finally code is running
Step-8 Now again create an image of this container and then push it anywhere you want:
here I have created an image of my container.
Step-9 Push this image on the Docker hub:
Give a tag to this image:
Push the Docker image to Docker Hub using the docker push command.
Now verify it with your docker hub account: