Introduction to Docker

Rayhan Muzakki
Pilar 2020
Published in
3 min readDec 21, 2020

When working on a project in a team each member would have their own laptop on working their tasks. If you are testing on a task that had passed in your own laptop but when testing on another member’s laptop the result failed, it means that the dependencies on the laptop are different and the member needs to install the same dependencies to test properly. However by using docker we can save those dependencies and the task as one so that when testing on the task it will have the same result on the 2 laptops.

source : https://www.iconfinder.com/icons/4373190/docker_logo_logos_icon

What is Docker?

Docker is a tool that is designed to make it easier to create, deploy, and run applications in another machine by using containers. Containers allows a developer to pack an application ,with all the dependencies and libraries needed , and deploy it as one package. This will result by having the application be used in other machines (such as Linux with different OS) without any problems with the compability of the machine.

Docker is similar to virtual machine where both can pack different apps with each libraries and dependencies as packages, the main difference is that virtual machine needs to contain an extra OS to work while Docker allows applications to use the same kernel as the system OS that they’re running on which results to performance boost and reduce the size of the application.

Advantages of Using Docker

There are points on why developers use docker and the reasons are:

  • Faster Development Process: There is no need to install 3rd-party apps on the system because it can be ran in containers and docker also gives users the ability to run different versions of same application simultaneously.
  • Application Encapsulation: Users can deliver packages in one piece, since docker gives users a unified image format to distribute applications across different host systems and cloud services means it can deliver your application in one piece with all the required dependencies.
  • Easy and Clear Monitoring: Users have a unified way to read log files from all running containers such that users don’t need to remember all the specific paths of the app and its dependencies when it stores logs.

How do We Implement Docker

In this current project I am working on the backend and the database of the app therefore instead of making dockerfile we implemented it differently.

Since we are using Gitlab the Gitlab runner has the function to combine Gitlab CI/CD and Docker so that it automatically makes a docker image in the CI/CD. Before we use docker we need to register a new runner to use the docker executor, the first step is to set up a temporary template to supply the services.

source : https://docs.gitlab.com/ee/ci/docker/README.html

Then we register the runner using the template made above.

source : https://docs.gitlab.com/ee/ci/docker/README.html

With this we would be able to use docker executor on our application, such as building docker images .

source: PILAR project

Conclusion

By using docker we can create, deploy, and run applications with ease independently because it helps pack the application and its dependencies into a package and can be run on any machines.

--

--