#Day 17 - Dockers Projects For DevOps Engineer.

Passionate AWS Developer | DevOps Engineer with a strong background in cloud architecture and solutions engineering. Leveraging the power of Amazon Web Services (AWS), knowledge of the AWS global infrastructure, design and implement robust cloud-based solutions that align with clients' specific needs.
Introduction to Docker File:
Dockerfile is a text document that contains a list of instructions that helps to build an image for the container. Containers are like a small package that holds everything an application need to run, to create these containers we use dockerfile.
Dockerfile tells the docker about what base image to use, what commands to run and what files to include. It is used to automate the process of configuring and creating images for containers.
Dockerfie commands:
FROMcommand: The first part is the FROM command, which tells us what image to base this off of.COPYorADD: Copies files from the host machine to the image.RUN: Executes commands during the image build process.CMD: Sets the default command to run when the container starts.ENTRYPOINT: Sets the main executable for the container.ENV: Sets environment variables inside the container.EXPOSE: Inform Docker about the ports the container will listen on.VOLUME: Creates a mount point for data persistence.WORKDIR: Sets the working directory for the image.USER: Specifies the user context for the container.
Task: 01
Create a Dockerfile for a simple web application (e.g. a Node.js or Python app).
First, create a simple web application in Python using Flask.
vim app.py

Now, write a Dockerfile for this web-app.
vim Dockerfile

Task: 02
Build the image using the Dockerfile and run the container.
Use 'docker build' command to build the image.
docker build . -t <name>
docker build . -t flask-app



Run the container:
use 'docker run' command to run the container.
docker run -d -p 5000:5000 flask-app:latest
docker ps

Task: 03
Verify that the application is working as expected by accessing it in a web browser
The application is running on Port 5000.
Check through the instance public IP.
[public-ip:5000]
Output:

Task: 04
Push the image to a public or private repository (e.g. Docker Hub )
To push an image to a public or private repository, you first need to have an account on the repository platform (e.g. Docker Hub) and be logged in.
Run the command docker push
sudo docker login
docker tag flask-app 291019955/flask-app:latest
docker push 291019955/flask-app:latest

Verify it in docker hub. My docker push seems a success.





