Docker Tutorial (1): What is Docker

Docker tutorial

This article is derived from the translation invitation of Concurrent Programming Network. The translation is the first article in the "Docker Tutorial" by Jakob Jenkov . This article roughly introduces what Docker is and what it is used for. Maybe in the work, there will be professional operation and maintenance students to manage server mirroring or other content, but if we do not understand these concepts, many times we will not fully understand the full picture of the system.

Docker is a method of packaging applications and server configurations into Docker images, using a simple packaging specification called Dockerfile. A Docker image can start multiple instances, and these running instances are called Docker containers. The content of this series mainly includes explaining what is a Docker image, what is a container, what is a Dockerfile, and how to create, run, and publish.

Advantages of Docker

The biggest benefits of using Dockerfile to package applications and server configuration are:

  • Don't forget how the server is configured, these configuration information are recorded in the Dockerfile.
  • It's easy to run the application on a brand new Docker host. You only need to deploy the Docker image of the application to this Docker host and start it.
  • You can use Kubernetes and Swarm to easily manage Docker containers in the cluster.
  • At present, many cloud server platforms can easily deploy Docker containers, and Docker has become a more independent deployment solution for the cloud.
  • The Docker container can be easily implemented on the customer's own server according to your application.

What is a Docker container

The Linux operating system has several features: running containerized applications on the operating system. These containerized features separate the file system and the network from each other between containerized applications. In other words, a containerized application cannot access the file system or network of another containerized application unless a special configuration is added to allow this operation. Docker uses the containerization features of Linux and exposes these features through a set of easy-to-use tools.

What is a Docker container

Docker container vs. virtual machine

Docker containers are similar to virtual machines in nature. The difference between the two is that the virtual machine has an additional operating system on the total stack. In other words, the virtual machine has a complete operating system, and then the virtual machine runs on a host with an operating system.

The implementation of a Docker container is different from a virtual machine. It does not have its own separate operating system and runs directly on the operating system of the host where it is located. Therefore, the Docker container is small enough because it does not contain a virtual machine operating system. The Docker container also runs very well because it does not require virtual machine virtualization.

Docker container vs. virtual machine

Dockerfile

As mentioned earlier, we can specify the content to be included in the Docker container through a Dockerfile defined by rules. The Dockerfile file contains a set of Docker instructions executed by the Docker command line tool. The result of the execution according to the Dockerfile is a Docker image. We can get a more detailed explanation from the Dockerfile tutorial . [Translator's Note: After the subsequent translation is completed, the link here will be replaced.

Docker image

When the Docker command line tool executes instructions according to the structure defined in the Dockerfile, it will produce a portable and runnable Docker image. This Docker image contains all the files and instructions required by the Docker container. The same Docker image can start multiple Docker containers.

Docker image

Docker warehouse

Docker images can be stored in a Docker warehouse, a storage warehouse that can upload and download Docker images. The Docker repository can be private, and only you, your organization or someone you designate can manage the mirrors in it, or it can be public. Anyone can manage the mirrors in it, or download Docker mirrors from it.

A public Docker warehouse is a good way to run potential users to download, install and run software. You only need to package the application as a Docker image, upload it to the public Docker warehouse, and your users can access and use it.

Docker company has used the Docker warehouse as a managed service, providing both private and public services. Some cloud service providers, such as AWS, AZure, and Google, also provide Docker warehouse servers that can upload their own Docker images. It is easy to use these images in virtual machines or Kubernetes on cloud infrastructure.

Docker warehouse

Docker command line tool

When Docker is installed in the operating system, the Docker command line tool will be installed at the same time. Docker command line tool can build Docker image through Dockerfile, upload Docker image to Docker warehouse, download Docker image from Docker warehouse, and operate Docker image to start or stop Docker container.

Docker Compose

Docker Compose provides a function to link multiple Docker containers into a combination. All containers in this combination can be deployed or stopped all at once. For example, running an application in a Docker container and a database running in a Docker container. The application depends on the database and starts or stops at the same time, which can realize that the database that the application depends on is not running normally.

Recommended reading


Hello, I am watching the mountain, the public account: watching the mountain hut, a 10-year-old ape, Apache Storm, WxJava, Cynomys open source contributor. Swim in the code world, enjoy life in drama.

Original link: Docker Tutorial
Translation: https://www.howardliu.cn
Translation link: Docker tutorial (1): What is Docker
CSDN homepage: http://blog.csdn.net/liuxinghao
CSDN blog post: Docker tutorial (1) : What is Docker

Public number: Watching the mountain hut

Guess you like

Origin blog.csdn.net/conansix/article/details/114497477