Abstract
In this article, we are going to see what is docker container and its usage with real-time examples.
Agenda
- What is docker
- What is a docker container
- What is used for
- Installation
- Create Image
- Run the docker image in the local machine
- Push the image into the repository
What is Docker
Docker is an open-source and container-based platform used to enable developers to create an image that has everything. In earlier days we used to work with virtual machines which run on top of the Hypervisor, so it takes huge memory and VM. However, In this case, docker works with the help of the Docker engine which is a lightweight module.
What is a docker container?
A docker container is a package of software that has a project and its dependencies as an image. This is a lightweight virtual environment to run the application, which means the image can run on any environment since it has all its pre-requisite and dependency inside the cocker container
What is used for
Typically docker is used to working for distributed applications that work effectively with different environments. In case you have multiple microservices created on different tech stacks and each service has its own dependencies. To deploy the whole application into a new environment, In earlier days we suppose to install all dependencies before deploying our project since docker gives a package that reduces this setup time frame and easy to execute anywhere option.
Installation Methodology
In docker, we have two flavors of repositories
- Public Repository ( Anyone can able to fork it and run it globally)
- Private Repository ( This package is restricted globally, which means it applies only for internal usage)
Please follow the below steps to install the docker in Chromebook (Debian OS)
Create an Image Container from the local machine
Once the development is done, create a docker file in your project repository and mention all its dependencies to run the application. For eg., If you running react application, the main dependency is the npm install command.
Steps to follow
- First Create a docker file and place an entry of all its dependencies
- Build it (docker build -t <project-name>)
Run Image as a container in your local machine
docker run <project-name>
Publish the image into the Repository
docker commit
docker push