安装依赖软件包
[root@localhost ~]# yum install -y yum-utils device-mapper-persistent-data lvm2
增加Docker的yum源
[root@localhost ~]# yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
安装Docker
[root@localhost ~]# yum install -y docker-ce
查看Docker版本信息
[root@localhost ~]# docker version
Client: Docker Engine - Community # 社区版
Version: 23.0.1 # Docker版本号
API version: 1.42
Go version: go1.19.5 # Go版本号
Git commit: a5ee5b1
Built: Thu Feb 9 19:51:00 2023
OS/Arch: linux/amd64
Context: default
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]#
设置开机自动启动Docker
[root@localhost ~]# systemctl enable docker
启动Docker
[root@localhost ~]# systemctl start docker
[root@localhost ~]# docker version # 再次查看Docker版本信息(和未启动Docker时的版本信息有所不同)
Client: Docker Engine - Community
Version: 23.0.1
API version: 1.42
Go version: go1.19.5
Git commit: a5ee5b1
Built: Thu Feb 9 19:51:00 2023
OS/Arch: linux/amd64
Context: default
Server: Docker Engine - Community
Engine:
Version: 23.0.1
API version: 1.42 (minimum version 1.12)
Go version: go1.19.5
Git commit: bc3805a
Built: Thu Feb 9 19:48:42 2023
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.16
GitCommit: 31aa4358a36870b21a992d3ad2bef29e1d693bec
runc:
Version: 1.1.4
GitCommit: v1.1.4-0-g5fd4c4d
docker-init:
Version: 0.19.0
GitCommit: de40ad0
[root@localhost ~]#