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)
-
Build the image using the Dockerfile and run the container
-
Verify that the application is working as expected by accessing it in a web browser - Check the public IP from the cloud console
Access the web using public IP -
Push the image to a public or private repository (e.g. Docker Hub) -
First, we need to create a repository in the Docker hub.
We need to authenticate our credentials for the docker hub account using the command -
docker login
providing the username and password.We need to update the tag using the command -
docker tag SOURCE_IMAGE:TAG DOCKERHUB_USERNAME/REPO_NAME:TAG
We need to push the image using the command -
docker push image:tag
Validate the image in the docker hub account.
-
Thank you :)