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.
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 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).
Naturally, the more benefits it brings, the more users it attracts. Using Docker brings many benefits, such as:
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.
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.
Containers in Docker are lightweight, much lighter than using virtual machines, so you can run more applications at the same time.
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.
Me & the desire to "play with words"
Have you tried writing? And then failed or not satisfied? At 2coffee.dev we have had a hard time with writing. Don't be discouraged, because now we have a way to help you. Click to become a member now!
Subscribe to receive new article notifications
Hello, my name is Hoai - a developer who tells stories through writing ✍️ and creating products 🚀. With many years of programming experience, I have contributed to various products that bring value to users at my workplace as well as to myself. My hobbies include reading, writing, and researching... I created this blog with the mission of delivering quality articles to the readers of 2coffee.dev.Follow me through these channels LinkedIn, Facebook, Instagram, Telegram.
Comments (1)