检查前提条件
检查内核版本是否高于3.8
uname -a
检查Device Mapper
ls -l /sys/class/misc/device-mapper
或者
grep device-mapper /proc/devices
若无,请安装
yum install -y device-mapper
安装完成后,加载dm_mod内核模块
modprobe dm_mod
安装Docker
设置阿里源
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-8.repo
安装依赖
yum install -y yum-utils device-mapper-persistent-data lvm2
添加docker-ce的yum仓库
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum makecache
安装docker-ce
yum install docker-ce
启动并设置开机自启动
systemctl start docker
systemctl enable --now docker
查看Docker运行状态
docker info
显示如下打印
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 0
Server Version: 19.03.13
Storage Driver: overlay2
Backing Filesystem: xfs
Supports d_type: true
Native Overlay Diff: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: 8fba4e9a7d01810a393d5d25a3621dc101981175
runc version: dc9208a3303feef5b3839f4323d9beb36df0a9dd
init version: fec3683
Security Options:
seccomp
Profile: default
Kernel Version: 4.18.0-193.14.2.el8_2.x86_64
Operating System: CentOS Linux 8 (Core)
OSType: linux
Architecture: x86_64
CPUs: 1
Total Memory: 791.5MiB
Name: localhost.localdomain
ID: YXYV:NBGI:LTFS:X3F7:Y7MN:OSHA:APHW:GA3Q:DOEB:7BCZ:FWDK:UON2
Docker Root Dir: /var/lib/docker
Debug Mode: false
Registry: https://index.docker.io/v1/
Labels:
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false