A Beginner Guide to Docker

Naura Azka
4 min readMay 24, 2021
Photo by Dominik Lückmann on Unsplash

According to Oxford Dictionary, Docker is “a person whose job is moving goods on and off ships”. Now, when we talk about software development, have you ever heard about “Docker”? Is it the same with that definition?

In this article, I will talk about Docker as a tool in software development and what you need to know. Please keep on reading^^

What Is Docker?

According to opensource.com,

Docker is a tool designed to make it easier to create, deploy, and run applications by using containers.

“Container” here will contain your software from the code to all the dependencies needed to run the application. By doing so, the developer can rest assured that the application will run smoothly on any other machine, without having to install all the dependencies every time we need to run the application in a different environment.

Docker Containers vs Virtual Machines

https://www.docker.com/blog/containers-replacing-virtual-machines/

In a way, Docker is a bit like a virtual machine. A container is an OS virtualization that can wrap an application with its dependencies and environment and allows applications to use the same Linux kernel as the system that they’re running on and only requires applications to be shipped with things not already running on the host computer. The difference between Docker and Virtual Machine is that Virtual Machine is virtualization technology at the hardware level, meanwhile, Docker is virtualization technology on operation system level.

Components of Docker

To understand it better, there are some terms that you need to know in Docker.

  • Docker Client: A place where user can type their command and interact with Docker, like CLI.
  • Docker Daemon: A persistent background process that manages Docker images, container, networks and storage volumes. Docker user cannot use docker daemon directly, they need to use it through the docker client.
  • Docker Image: File containing information and guide to build container. A read-only template that can be used to make a docker container. We can build several docker containers from one docker image.
  • Docker Container: A layer above docker image, an environment to unite and run the application. The container includes the code, runtime, system tools and dependencies. Once a docker container is created, they started to perform tasks within the container.
  • Docker Registry: A place to keep docker images that are private or public online. By using the docker registry, you can use the docker image that is created by another developer. When a docker image is given a “docker push” command, the docker image will be posted in the Docker Hub registry.

How Docker Works

Docker: Components (Client, Host, Daemon, etc.) - Knoldus Blogs Docker
https://blog.knoldus.com/docker-components/

Now let's see how docker works. Based on the image shown above, the schemes are like this:

First, the docker client will receive commands from a user and communicate with the Docker daemon through Rest API. The communication mainly about commands that need to be done. As shown above, the docker build command is used to build the image. Another command, docker pull is used to download the image from the docker registry while docker run will run all the processes in the container.

Docker daemon, as stated before, will manage the images and containers by listening to commands given by the docker client.

Benefits of Docker

There are several benefits that you can get by using Docker, here are some of them:

  1. Simple Configuration — With just a few lines of code, Docker can make a different environment from the main server. It also easy to make a Docker Image, you only need to make a Dockerfile contains the configuration about what needs to be done to run the application, and dependencies needed for the Image to run smoothly.
  2. Multi-Cloud Platform — Not only Docker can run in one platform cloud, but it can also run in many different platform cloud.
  3. Isolation — Docker isolates every resource in any container so that user can adjust their needs without affecting other app configuration
  4. Security — Docker make sure that the application running cannot affect the container or given full control for the management and traffic.

Flow Deployment

1.Build app, run this command in the same directory as Dockerfile:

docker build --tag=<image_name>

2. Tag Image, run this command after you are done making the image to continue the deployment process:

docker tag <image_name> <registry_link>/<repository_name>:<tag>

3. Push image, push to the registry with this command:

docker push <registry_link>/<repository_name>:<tag>

And that's it! I think that's all you need to know for an introduction to Docker. Are you interested to learn more?

--

--