Docker (2) --- installation (set mirror accelerator)

Insert picture description here

Previous: Docker (1)-basic concept

1. Docker installation premise?

  Currently, only the kernel in the release version of CentOS supports Docker.

  Docker running on CentOS7 requires the system to be 64-bit and the system kernel version to be 3.10 or higher.
  Docker runs on CentOS-6.5 or higher, and requires the system kernel to be 2.6.32-431 or higher

Check your own kernel:uname -r

[root@tomcat-tst ~]# uname -r
3.10.0-514.10.2.el7.x86_64

View CentOSversion information:cat /etc/redhat-release

[root@tomcat-tst ~]#  cat /etc/redhat-release 
CentOS Linux release 7.7.1908 (Core)

2. CentOS install Docker?

  Official documents

Ensure that CentOS can connect to the Internet normally.

1.安装gcc相关资源库
yum -y install gcc
yum -y install gcc-c++

2.如果需要卸载旧版本,则使用以下命令:
yum -y remove docker docker-common docker-selinux docker-engine

3.需要安装的软件包:
yum install -y yum-utils device-mapper-persistent-data lvm2

4.设置stable镜像仓库

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

5.更新yum软件包索引
yum makecache fast

6.安装docker ce
yum -y install docker-ce

7.启动docker
systemctl start docker

8.测试
docker version(查询docker的版本)
docker run hello-world(刚安装docker本地没有“hello-world”镜像文件,所以docker会到aliyun
的镜像仓库上拉取,然后再run)

9.卸载
systemctl stop docker
yum -y remove docker-ce
rm -rf /var/lib/docker

3. How does Docker set up an image accelerator?

  The way to get the image file is generally to Docker Hubpull it from the official website, but because the speed is too slow, we can pull it from the official website of Alibaba Cloud's image file:

Alibaba Cloud official website

  After obtaining your own accelerator address, just copy and paste 2.配置镜像加速器the commands in the figure below on the linux system .
Insert picture description here

Next: Docker (3)-commonly used commands

Published 117 original articles · Like 57 · Visitors 10,000+

Guess you like

Origin blog.csdn.net/qq_43655835/article/details/104900316