Series on Docker in Practice & Production - What Makes Docker So Popular?

Series on Docker in Practice & Production - What Makes Docker So Popular?

Daily short news for you
  • Everyone using Cloudflare Worker to call OpenAI's API should be careful, I've encountered the error unsupported_country_region_territory these past few days. It's likely that the Worker server is calling from a region that OpenAI does not support.

    It's strange because this error has only occurred recently 🤔

    » Read more
  • A few days ago, Apple introduced a container tool developed by themselves and open-sourced as apple/container. It is used to create and run Linux containers as lightweight virtual machines on Mac, optimized for the Silicon chip line. Does that sound familiar? Kind of like Docker, right? 😄

    Docker on Mac needs to run a Linux virtual machine to use containers, and now with Apple introducing this, maybe Docker will see an update soon. We don’t know how the performance will be yet; we’ll have to wait for evaluations from experts. It’s neither Go, nor Rust, nor C... apple/container is written in... Swift. Wow, that’s quite astonishing. 😳

    » Read more
  • Before, I mentioned that github/gh-copilot is a command-line tool that suggests commands or explains them. While browsing through some "comments," I discovered a rather interesting way of using it that I hadn't expected. That is to set an alias for the command gh copilot suggest as "??" and "???" and then, after getting used to it, it becomes extremely convenient. For example, if you want to compress a directory into a tar.gz format but forget the syntax, you can simply do: bash $ ?? "compress the pages directory into .tar.gz" Or if you encounter a command that is hard to understand, you can use: bash $ ??? "tar -xzvf pages.tar.gz pages"

    » Read more

Issue

In recent years, the name Docker has been shaking up the programming world. Everyone is using Docker, from developers to non-developers.

Remember a few years ago when I was still tinkering with my laptop. I had a passion for installing Windows, reinstalling it several times a month. Sometimes I installed Windows, other times Ubuntu. Each time, I had to set up the development environment on my machine, whether it was MySQL server or PostgreSQL, MongoDB...

But installing these things on Windows was tiring. I had to go to different websites to download and install them, which took a lot of time. Overall, setting up the environment I needed at that time could take an entire half-day or even longer.

However, Ubuntu made things easier. Ubuntu only required a simple and quick command to install. That's why I started to prefer Ubuntu as my main development environment.

At that time, I hadn't heard of Docker yet. I only heard about it briefly, but I didn't have a need to dig deeper until I was assigned to a project that required working with Docker to build images for deployment. It was then that I truly began to explore what Docker was and what benefits it could bring.

At first, I searched for articles about Docker in Vietnamese, but I was still not satisfied with the answers to my questions. There were too many concepts to remember, such as images, containers, registries... There were so many things that I didn't understand their functions.

So I decided to make time to read the documentation on the Docker website. I recommend that you, especially those who are new to Docker, take the time to read the Docker documentation during or after reading this series. This series simply summarizes the basic knowledge and provides guidance for those who want to learn about Docker. Therefore, it is not possible to cover all the knowledge about Docker in this series.

The "Docker in Practice & Production" series is expected to include 5 articles, starting from an introduction to how to deploy a product in production. In terms of knowledge, I hope that after the series, you will have a basic understanding of Docker, its components, how to use it, and how to deploy applications.

Again, I don't claim to understand everything about Docker. The knowledge I am about to share with you is what I have learned during my learning and work experience with Docker. I look forward to receiving feedback from you.

What is Docker?

Let me quote an English excerpt from Docker's documentation:

Docker is an open platform for developing, shipping, and running applications. Docker enables you to separate your applications from your infrastructure so you can deliver software quickly. With Docker, you can manage your infrastructure in the same ways you manage your applications. By taking advantage of Docker’s methodologies for shipping, testing, and deploying code quickly, you can significantly reduce the delay between writing code and running it in production.

Simply put, Docker is a platform that allows you to package and run applications in an environment called a container.

Applications here can be popular platforms like MySQL server, MongoDB... With Docker, you can easily create a MySQL server, a MongoDB server, and what's special is that you can run multiple of them at the same time.

Docker Architecture

Docker Architecture

Docker uses a client-server architecture, in which the Docker daemon acts as the server and processes client requests. The client can be dockerd, which allows sending common commands like build, run, pull... to the Docker daemon for processing. To understand the components in Docker's architecture more clearly, you can read more here.

The Docker daemon manages the basic components in Docker such as Container, Image, Network, allowing them to work together. In addition, there is the Registry which serves as a storage location for Docker Images (think of the Registry as a git Repository).

Benefits of Using Docker

Naturally, the more benefits it brings, the more users it attracts. Using Docker brings many benefits, such as:

Rapid and consistent application distribution.

Docker supports CI/CD very well. The tasks we need to do to develop and release a product, including creating an image, launching the image with a container, and a series of automated or manual testing commands, can all be set up to run automatically.

Packaging applications into a single image also reduces the need to install many dependencies when running an application that someone shares with you. For example, if you want to run a program coded in Python by a colleague on your machine, while you are a Node.js developer and have not installed Python, you need to install Python, right? But with Docker, your colleague only needs to build an image that can run that program and give it to you. You only need one command to start that image quickly, minimizing the chance of errors that may occur during the Python installation process.

Quick and easy deployment and scalability.

Docker allows you to deploy applications using a single command or a set of commands in a .yaml file.

Imagine that every time you need to set up a working environment on a new machine, with Docker, this setup process is quite easy if you have created your own .yaml files beforehand.

Docker also provides something called Docker Swarm, which allows us to easily scale our application deployment. Imagine if the Docker server on your machine runs out of memory or CPU, you can join another Docker server to the cluster to scale them.

Running multiple applications simultaneously on a single hardware.

Containers in Docker are lightweight, much lighter than using virtual machines, so you can run more applications at the same time.

Conclusion

Docker is a platform that allows you to package and run applications in containers. Understanding and utilizing Docker will bring great benefits, whether you are a frontend developer or a backend developer. In the next part, I will discuss the basic components of Docker and their uses. Make sure to follow the blog regularly.

Premium
Hello

5 profound lessons

Every product comes with stories. The success of others is an inspiration for many to follow. 5 lessons learned have changed me forever. How about you? Click now!

Every product comes with stories. The success of others is an inspiration for many to follow. 5 lessons learned have changed me forever. How about you? Click now!

View all

Subscribe to receive new article notifications

or
* The summary newsletter is sent every 1-2 weeks, cancel anytime.

Comments (1)

Leave a comment...
Avatar
Trịnh Cường4 years ago

Mình rất thích cách giải thích và diễn giải của bạn. dự án của mình cũng đang áp dụng docker.rất bổ ích và thú vị. ra phần tiếp theo nhanh nhé bạn :)).

Reply
Avatar
Xuân Hoài Tống4 years ago

Cảm ơn một bạn fan cứng. Ghé blog thường xuyên nhé!