How to install Docker on Linux?

Docker

1. What is Docker?

1. Concept

Virtual container technology: docker is a kind of virtualization technology. Virtual container technology simulates a very small linux system (dockerfile)

  1. Sandbox mechanism: applications created based on an exe file are independent of each other

  2. Mirror image: It is like creating the .iso image file of the centos system in windows. In docker, the image file

  3. Container: The system created based on the docker image (equivalent to the linux system created by the .iso image)

  • windows — virtual technology (vmware software) — .iso image file — get a centos system
  • Linux — virtual technology (docker software) — image file (very small) — get a centos system

2. Advantages

  1. fast build environment
  2. Very little resource usage
  3. O&M is easier
  4. One machine can create N containers, making reasonable use of resources and saving resources

3. Application

  1. Deployment test environment, production environment, acceptance environment

  2. microservice structure

  3. Deployment of automated projects

2. Docker installation

https://docs.docker.com/engine/install/

Docker cleans up the environment before uninstalling

sudo yum remove docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-engine

View linux information (confirm whether it is centos)

need to installlsb_release

yum install lsb_release
lsb_release -a

1. The yum package is updated to the latest

sudo yum update

1. Manual installation

1. Install the required software package yum-util to provide yum-config-mamager function, and the other two are dependent on the devicemapper driver

sudo yum install -y yum-utils

2. Set the yum source to Alibaba Cloud (faster)

yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

3. Install docker (docker-ce community version is free)

yum -y install docker-ce docker-ce-cli containerd.io

4. Check the docker version after installation

docker -v

5. Set up the ustc mirror site (specify the registration center address)

This file is empty after installation

vim /etc/docker/daemon.json

{
    
    

"registry-mirrors":["https://docker.mirrors.ustc.edu.cn"]

}

6. Script installation

1. Install the release version

curl -fsSL https://get.docker.com -o get-docker.sh -o test-docker.sh

sh get-docker.sh

Guess you like

Origin blog.csdn.net/AAIT11/article/details/130075154