前言
Docker 要求 CentOS系统的内核版本高于 3.10, 通过 uname -r 命令查看你当前的内核版本
安装
yum update -y yum -y install docker
若要安装最新版本,可执行
curl -fsSL https://get.docker.com/ | sh systemctl start docker
ps:若安装过程出现以下类似错误,是因为系统的python版本升级导致.

找到对应的文件,如/usr/bin/yum

所有的python版本一般在/usr/bin/目录下,也可用whereis python查看
配置国内镜像源
ps:docker安装好后默认没有此文件,需要手动创建,添加阿里云镜像节点,并指定docker存储目录
vim /etc/docker/daemon.json
{
"registry-mirrors" :[
"http://ovfftd6p.mirror.aliyuncs.com",
"http://registry.docker-cn.com",
"http://docker.mirrors.ustc.edu.cn",
"http://hub-mirror.c.163.com"
],
"insecure-registries" : [
"registry.docker-cn.com",
"docker.mirrors.ustc.edu.cn"
]
}
启动docker,并加入开机启动
systemctl start docker systemctl enable docker
测试
下载hello-world镜像
docker pull hello-world

运行hello-world镜像
docker run hello-world
