Docker believes that everyone is not default, not practiced children’s shoes should also hear his name, the author has been using Docker to solve various problems for a long time recently, and in the recent Kubernetes pit climb up to practice, so from today, the author will bring Docker containerization related blog posts, together to explore D Why ocker is so popular, and how we can actually use it.

Attach:

A meow blog :w-blog.cn

Official Git address :github.com/moby/moby

1. Why is Docker so popular

  • Up to now, Docker has 48,570 stars on Github
  • Alibaba Cloud, Tencent Cloud and AWS have all launched their own Docker platforms
  • 70% of surveyed companies are already using or considering using Docker;

In retrospect, software systems (such as Hadoop) that managers used to be popular solved pain points in one field, and Docker is no exception. The author summarizes the following pain points that Docker solved:

  • Before I installed a software, there may be various dependencies that are extremely complex (such as APPRTC). Docker can package the environment dependencies together and use them out of the box with only one command
  • Isolation – Each user instance is isolated from each other. For example, your program A needs to use PHP7.0, and program B needs to use PHP7.2, but program A cannot use PHP7.2. When virtual, you can only choose to open two, using Docker can run smoothly in the same server without affecting each other
  • Quotaable/measurable – Each user instance can provide its computing resources on demand, and the resources used can be measured. The author once had an accident in the operating environment, which was mainly due to the fact that all other programs could not be accessed except for the CPU high caused by the point problem of APPLICATION A. Some Docker could allocate resources to limit unimportant programs without affecting important ones
  • Mobility – Instances of users can be easily copied, moved, rebuilt, and rolled back.
  • Basically no additional performance consumption Docker is directly transplanted to the Linux kernel, by running Linux processes to virtually isolate the underlying devices, so that the loss of system performance is much lower than the virtual machine, almost negligible. At the same time, the start and stop of Docker application container is very efficient, which can support the horizontal expansion of large-scale distribution system, which really brings good news to enterprise development.
  • DevOps continuous iterative delivery Docker technology packages applications for delivery in containers, enabling them to be shared among different teams, and mirroring applications that can be deployed in any environment. This avoids the problem of collaboration between teams and becomes an important tool for organizations to achieve DevOps goals. Docker technology delivered in container mode supports continuous development and iteration, greatly improving the speed of product development and delivery.

As Liu Yankai, chief expert of Cloud integrated computing technology of China HP, said, “The development of any technology and its popularity are all because it can solve the problem that bothers people”, and Docker is designed to solve this problem

2. Construction and installation

  • Mac installation
  • Ubuntu installation
  • Windows installation
  • Centos install

Select Centos to install Docker

  1. Install the required packages. Yum-utils provides yum-config-manager utility, and DEVICe-mapper-persistent-data and LVM2 require devicemapper to store drivers.
> yum install -y yum-utils device-mapper-persistent-data lvm2Copy the code

  1. Use the following command to set up the Release repository. Even if you want to install builds from edge and Test repositories, you will always need the Release repository.
> yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repoCopy the code

  1. Optional: Enable edge and Test repositories. These repositories are included in the files above docker.repo, but are disabled by default. You can enable them with a stable repository
> yum-config-manager --enable docker-ce-edgeCopy the code

> yum-config-manager --enable docker-ce-testCopy the code

You can disable edge and Test repositories by running commands with this flag.

> yum-config-manager --disable docker-ce-edgeCopy the code

Install the Docker CE

To install the latest version of docker-CE, run the following command

> yum install docker-ceCopy the code

If multiple Yum repositories are enabled, installing or updating without specifying the version Yum install or the Yum update command will always install the highest possible version, which may not be appropriate for your stability needs.

On production systems, you should install a specific version of Docker CE instead of always using the latest version. Lists available versions.

This example uses the sort -r command to sort the results by version number, from highest to lowest.

> yum list docker - ce - showduplicates | sort - r docker - ce. X86_64 18.02.0. Ce - 1. El7. Centos docker - ce - edge docker - ce. X86_64 Centos docker-ce-edge docker-ce. X86_64 17.12.1. Ce-1.el7. Centos docker-ce-stable docker-ce Centos docker-ce-edge docker-ce-x86_64 17.12.0.ce-1.el7. Centos docker-ce-stable docker-ce-x86_64 17.12.0.ce-1.el7 Centos docker-ce-edge docker-ce.x86_64 17.11.0.ce-1.el7. Centos docker-ce-edge docker-ce.x86_64 17.11.0.ce-1.el7 17.10.0. Ce - 1. El7. Centos docker - ce - edgeCopy the code

The content of the list depends on which repositories are enabled and is specific to your centos.el7 version (in this case, indicated by the version suffix). Select a specific version to install. The second column is the version string. You can use the entire version string. The third column is the repository name, which indicates which repository the package came from. To install a specific version, append the version string to the package name separated by a hyphen (-).

Note: The version string is the version of the package name followed by the first hyphen. In the example above, the full package name is docker-CE-17.03.0.ce

In order to build Kubernetes later, please refer to the description in the update log

Md at Master · kubernetes/kubernetes · GitHub

--Docker 1.11.2 to 1.13.1 and 17.03.2Copy the code

Here select Rancher certified 17.03.2 and K8S supported version

Docker-ce-selinux-17.03.2. ce Error # yum install docker-ce https://download.docker.com/linux/centos/7/x86_64/stable/Packages/docker-ce-selinux-17.03.2.ce-1.el7.centos.noarch.rpm > Yum install docker - ce - 17.03.2. CeCopy the code

Start Docker and set it to boot.

> systemctl start docker
> systemctl enable dockerCopy the code

Docker verifies the installation by running the Hello-world image.

> docker run helloworld # hello from docker!Copy the code

3 summary

The first step has been completed and the Docker environment can be used. Next we need to be familiar with some commands related to Docker

Note: I have limited ability to say the wrong place hope we can point out, but also hope to communicate more!