Day 17: Docker Project

Day 17: Docker Project

ยท

2 min read

#Day17 of #90DaysofDevops challenge

Click here to view Day 17 Task.

Dockerfile

Docker is a tool that makes it easy to run applications in containers. Containers are like small packages that hold everything an application needs to run. To create these containers, developers use something called a Dockerfile.

A Dockerfile is like a set of instructions for making a container. It tells Docker what base image to use, what commands to run, and what files to include. For example, if you were making a container for a website, the Dockerfile might tell Docker to use an official web server image, copy the files for your website into the container, and start the web server when the container starts.

Task:

  • Create a Dockerfile for a simple web application (e.g. a Node.js or Python app)

    1. Clone the application repository using 'git clone' command

    2. Create and configure Dockerfile

  • Build the image using the Dockerfile and run the container

    1. Build an image named "todo-app" using Dockerfile

    2. Now run the container using image built in the above step

  • Verify that the application is working as expected by accessing it in a web browser

    Now you can take the public IP of the machine and port 8001 to access the application.

    Application is working as expected.

  • Push the image to a public or private repository (e.g. Docker Hub )

    1. Log in to Docker Hub

    2. Select repositories and then create repository named "todo_app"

    3. Tag the locally created image to the docker hub

    4. Now push the image to the Docker hub using the push command.

      Docker image is successfully uploaded to Docker Hub.

Thank you for reading!๐Ÿ

Nidhi

ย