Installation of Docker in Linux CentOS7

I. Introduction

Insert picture description here


1.1 Inconsistent environment

I have no problem running locally: due to the inconsistent environment, the same program results in inconsistent operation.

1.2 Isolation

Which buddy writes infinite loop again, why is it so stuck: In a multi-user operating system, some of your own programs will be affected because of other users' operating errors.

1.3 Elastic scaling

Taobao’s user base surged during Double 11: It required a lot of operation and maintenance personnel to increase the number of servers deployed, which caused the problem of excessive operation and maintenance costs.

1.4 Learning costs

To learn a technology, you must install it first: To learn each technology, you must first install the corresponding software, but there are also various environments that it depends on. The cost of installing the software is faster than the cost of learning.

Two, Docker introduction


2.1 The origin of Docker

A group of young people started their own businesses and founded a company, dedicated to PAAS platform in 2010. But in 2013, companies like Amazon, Microsoft, and Google started to make PAAS platforms. In 2013, the company's capital chain broke and it had to go bankrupt, so the company's core technology was open sourced, and the core technology was Docker. Due to the open source of Docker, in 2014, it received a C round of financing of $4000W, and in 2015, it received a D round of financing of $9500W. So the company began to concentrate on maintaining Docker.

Docker lead author-Solomon
Insert picture description here
The author of Docker has left the team that maintains Docker
Insert picture description here

2.2 The idea of ​​Docker

  • Container: Put all the required content in different containers, and whoever needs these environments can get this container directly.

  • standardization:

    • Standardization of transportation: Docker has a dock, and all uploaded containers are placed on this dock. When anyone needs a certain environment, they can directly assign the sea to carry the container.
    • Standardization of commands: Docker provides a series of commands to help us get containers and other operations.
    • Provides REST API: a lot of graphical interfaces are derived, Rancher.
  • Isolation: When Docker runs the contents of the container, it will create a separate space in the Linux kernel, and this space will not affect other programs.

  • Central Warehouse|Registration Center: Super Dock, with containers on it

  • Mirror image: container

  • Container: the running image

Three, Docker installation


3.1 Download the environment that Docker depends on

To install Docker, you need to download all dependent environments first, just like Maven depends on JDK

Reference: https://developer.aliyun.com/article/110806

If it is installed, you can delete it first

[root@localhost ~]# yum -y remove docker-ce

[root@localhost local]# yum -y install yum-utils device-mapper-persistent-data lvm2

3.2 Specify Docker image source

The default download Docker downloads back to the foreign server, the speed is slower, we can set it as the Aliyun mirror source, the speed is faster

[root@localhost ~]# yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3.3 Install Docker

Still use yum to install

[root@localhost ~]# yum makecache fast
[root@localhost ~]# yum -y install docker-ce

3.4 Start Docker and test

After the installation is successful, you need to start it manually, set it to self-start after booting, and test Docker

# 启动Docker服务
[root@localhost ~]# systemctl start docker
# 设置开机自动启动
[root@localhost ~]# systemctl enable docker
# 测试 hello-world
[root@localhost ~]# docker run hello-world

Note: The installation documents for different Linux versions of Docker are as follows:
CentOS version document address: CentOS version document address
Debian version document address: Debian version document address
Ubuntu version document address: Ubuntu version document address
Fedora version document address: CentOS version document address

Guess you like

Origin blog.csdn.net/qq_16733389/article/details/115280603