Centos7中安装Docker的操作步骤
-
查看Linux的发行版,内核(系统环境)
$ cat /etc/redhat-release #查看版本号 CentOS Linux release 7.8.2003 (Core) $ uname -r # 查看Linux内核 3.10.0-1127.el7.x86_64
-
替换yum源
# 下载阿里yum源2 $ wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo # 生成仓库缓存 $ yum makecache # 更新yum $ yum -y update
-
安装docker
$ yum -y install docker
-
启动docker
$ systemctl start docker # 启动docker $ systemctl enable docker # 开机启动docker $ systemctl status docker # 查看docker状态
-
查看docker版本并测试docker安装
$ docker version Client: Version: 1.13.1 API version: 1.26 Package version: docker-1.13.1-161.git64e9980.el7_8.x86_64 Go version: go1.10.3 Git commit: 64e9980/1.13.1 Built: Tue Apr 28 14:43:01 2020 OS/Arch: linux/amd64 Server: Version: 1.13.1 API version: 1.26 (minimum version 1.12) Package version: docker-1.13.1-161.git64e9980.el7_8.x86_64 Go version: go1.10.3 Git commit: 64e9980/1.13.1 Built: Tue Apr 28 14:43:01 2020 OS/Arch: linux/amd64 Experimental: false
如果出现上述信息,则说明docker安装成功,安装的docker版本为1.13.1
。