Let’s get to know more about docker!

Ashila Ghassani
4 min readMay 2, 2021
Source : Dev community

The tools for software development are so numerous that it’s hard to keep track of all the technologies used in a project. If there is a condition where you test a task on your laptop the results passed, but when the test on another member’s laptop and the results failed, it means the dependency on the laptop is different. Therefore, each development team needs to install the same dependency to test it properly. That’s why we need a docker!

What is Docker?

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers. Containers allow a developer to package up an application with all of the parts it needs, such as libraries and other dependencies, and deploy it as one package. By doing so, the developer can rest assured that the application will run on any other Linux machine regardless of any customized settings that machine might have that could differ from the machine used for writing and testing the code.

Why Docker?

As I said before, so that there are no different test results and get passed on whatever device the team members are using, we need to use a docker. Besides that, there are other reasons why we need to use docker :

  1. Docker supports multiple applications with different application requirements and dependencies, to be hosted together on the same host, as long as they have the same operating system requirements.
  2. Reduces costs. Docker is less demanding when it comes to the hardware required to run it.
  3. Storage Optimized. A large number of applications can be hosted on the same host, as containers are usually few megabytes in size and consume very little disk space.

Docker Components

Docker Registry

Docker registry is also known as a docker hub. The Docker registry is a storage for all docker images. Docker images can be saved as a public or private repository (like git). We can pull or push from the docker hub.

Docker Images

Docker images are used for creating containers. The Docker image contains all dependencies for an application. We can pull or push the docker image to the docker hub.

Docker Containers

Docker containers are runtime instances of docker images. The Docker container will contain everything our application needs.

Docker Compose

The docker-compose allows several applications to run in multiple containers with just a single command.

Docker Orchestration

Docker (container) orchestration is a process that automates the deployment, management, and scaling of microservices. Docker orchestration can assist with the automation process of managing and coordinating containers.

How Docker Orchestration Works

Docker orchestration tools consist of docker machines (tools that determine hosts and install docker engines), docker swarm (a tool that will group multiple Docker hosts into a single host), and docker-compose (create the necessary containers and deploy multi-containers applications).
How it works :
1. Configuration file will tell the Docker orchestration tool how to connect the container and the log storage area.
2. Docker orchestration tools will group the deployment of containers and determine the correct host for those containers.
3. Orchestration tools will then manage the container lifecycle based on the predefined conditions.

Implementation of Docker

In PPL, since we are using Gitlab, the Gitlab runner has the function to combine Gitlab CI/CD and Docker. That function is called image. It automatically makes a docker image in the CI/CD. This Docker image function runs containers. Our team CI / CD application job was done on a docker container. The Docker images we use on our backend project are python, sonar, and ruby. We use python because our backend application uses the Django framework. Then, sonar is used to connect our application with sonar. The last, Ruby is used because our backend application is deployed to Heroku which is a Ruby application.

It can be seen on the gitlab.ci.yml page :

Conclusion

Docker is one of the most popular container management tools for software developers. So learning docker will help you on your software development journey!

Source :

--

--