Docker ecosystem

Today I read a pretty good song by author @lherrera on medium , it explains quite a lot of information to you guys starting with Docker. I ask for a translation (some sections are simple and easy to understand as well as some other parts to explain more carefully)

When you first started with Docker you could be confused with a forest of Docker-something-style tools. There's a Docker Client tool, something called Docker Engine, then there's a tool called Docker Machine, then build the cluster with Docker Swarm, then pack multi-containers with Docker Compose and other stuff … Listen I was stunned.

So the purpose of this article is that we will try to understand the meaning of those tools and the relationship between them to better understand the Docker ecosystem.

1. Docker Engine

It is a lightweight runtime tool (this word I don't know how to translate stars), it helps us build and run Docker containers . In essence, Docker is a client-server application . Docker Client will talk to Docker Engine through a RESTful API, to execute commands like build , ship and run a container as the example below

Screen Shot 2016-07-11 at 11.22.58 AM

Here, the command is docker docker Client, when you type the command docker Client version is essentially Docker Docker Engine API call with GET method through unix-socket.

This means that it is possible to communicate with Docker Engine with another tool, as long as it "knows" how to call the Docker Engine APIs. The list of APIs is provided at the link .

There are 4 large objects in the world of Docker Engine and they all have IDs. And somehow, let them work together so we can buid, ship and run our application anywhere.

  • Images : image is used to package applications and application dependencies. Images can be stored locally or on a registry. Registry is a service that helps organize and provide repositories of images.
  • Container : container is a running instance of a Docker Images. If you find it too confusing, you can associate it with a virtual machine in terms of functionality.
  • Network : Provides a private network that exists only between the container and the host. Starting from version 1.09, the private network can be expanded on multi-hosts. You can read more about docker network in one of your articles @huydx .
  • Volume : volume is designed to store data independently of the container life cycle.

We will take a look at a diagram illustrating the common commands of Docker Client and the relationship between the above 4 components.

Screen Shot 2016-07-11 at 11.23.34 AM

In addition, Docker Engine allows loading third-party plugins to expand other functions. For example, Flocker is a volume-plugin that provides volume mechanism for multi-host or Weave is a network-plugin that allows creating a virtual network, connecting Docker containers on multiple hosts together, enabling automatic discovery of applications. use.

2. Distribution tools

Docker provides three distributed tools that help us store and manage Docker images. To build a private registry and store private images we can use one of the following two tools:

  • Docker Registry : an open source image distribution tool to store and manage images
  • Docker Trusted Registry : a paid tool, it's different from the Docker Registry that has a management interface and provides some security features (listen to it)

And also we have a service

  • Docker Hub : this is a service when you don't want to manage the registry yourself. Provide public and private image repository. By default Docker Client will use Docker Hub if no registry is configured. Above there are many offcial images of software like nginx, mongodb, mysql, jenkins …

3. Orchestration tools

  • Docker Machine : is a provisioning tool that makes it easy to access from "Zero to Docker". Machine creates Docker Engine on your laptop or on any popular cloud service like AWS, Azure, Google Cloud, Softlayer or on data center systems like VMware, OpenStack. Docker Machine will create virtual machines and install Docker Engine on them and eventually it will configure Docker Client to communicate with Docker Engine securely.
  • Docker Swarm : is a tool that helps us create a Docker clustering. It helps us to bundle many Docker Engine together and we can "look" at it as a single virtual Docker Engine. Of course, any tool that can communicate with Docker Engine will also communicate with Docker Swarm normally in accordance with the Docker API standard, and of course transparent. A Swarm cluster can be configured and deployed via Docker-Machine. And according to Docker's test, they can scale 30,000 containers per 1000 AWS nodes with only one Swarm Manager. You can see it similarly to Kubernetes, but according to Docker their Swarm tool is lightweight and 5 times faster than Kubernetes .
  • Docker Compose : is a orchestration tool that helps you create multi-containers easily (note the object is container, not host or engine). Of course Docker Compose can also work with Swarm to be able to create multi-container. By default, Docker Compose will create a single-network for your applications and the containers can access each other through this network. If it is still difficult to understand, you can see an example as follows

Screen Shot 2016-07-11 at 11.24.05 AM

In general it will help us create container service votes, redis containers, container workers, container db, container result nodejs. With Docker Compose we will not need to manually create each container as before.

4. Management tools

This part I will not say much, because the 3 tools in full are paid tools, I have no need for these tools so if you are curious, you can find out with the keywords as below.

  • Docker Universal Control Plane
  • Docker Datacenter
  • Docker Cloud

5. Tools for local environments

On the local side we have the following tools to support the development process.

  • Docker Toolbox : Because Docker Engine uses some features of the Linux kernel, we won't be able to run Docker Engine natively on Windows or BSD. In previous versions, we will need a virtual machine to install a certain Linux version and then install Docker Engine on that virtual machine. This means from Docker Client -> VirtualBox (VM Linux) -> Docker Engine instead of directly from Docker Client -> Docker Engine as on Linux. If you use Mac OS X and Microsoft Windows, it will help you install the Docker Client, Docker Compose, Docker Machine, Docker Kitematic (a GUI client), and use VirtualBox to deploy Docker Engine on boot2docker (tinycore). As shown below.

Screen Shot 2016-07-11 at 11.24.43 AM

  • Docker for Mac and Docker for Windows : In the recent version, Docker launched this tool in beta, and is currently public beta. However, you have to remember that Docker Engine still can't run on Windows or BSD (I personally believe it will be the same later). It's actually still running on a Linux virtual machine. The difference is that you don't have to use VirtualBox. For Mac, Docker Engine will run on xhyve Virtual Machine (VM), xhyve is a lightweight virtualization solution on OSX, and this virtualized distribution is Alpine Linux, a very small distribution. For Windows, Docker Engine will also be on an Linux Alpine virtual machine, on Windows virtualization technology, Hyper-V, which would make the system know Hyper-V. With Hyper-V, there will be some requirements for the Windows version and hardware (this section you will find out, I am not interested in M ​​$).

There is a question here as to why not use VirtualBox but have to switch to a new platform. If you know a little about virtualization, VirtualBox is a type-2 hypervisor, and Hyper-V is a type-1 hypervisor. The difference is speed, that's all.

6. Summary

Docker allows us to build, ship, and run any application anywhere.

  • Build : Docker Engine (docker buid -t ) and Docker Compose (docker -compose build , for multi-containers)
  • Ship : Docker Registry, Docker Trusted Registry, Docker Hub (SaaS)
  • Run : Docker Engine (docker run ), Docker Swarm (Docker Engines cluster), Docker Compose (docker -compose up )
  • Manage : Universal Control Plane Docker and Docker Cloud (CaSS)
  • Provisioning of Docker Engines : Docker Machine (on most popular public cloud and your own infrastructure) or Docker Toolbox, Docker for Mac, Docker for Windows (for your laptop)

Ok, hope it is useful for those who are starting with Docker and getting a better understanding of the Docker ecosystem

ITZone via kipalog

Share the news now