官方参考文档,也可以查看安装文档详细说明。
1.安装依赖软件包
- [root@localhost ~]# sudo yum install -y yum-utils device-mapper-persistent-data lvm2
2.添加软件仓库
我们这⾥使⽤稳定版 Docker, 执⾏下⾯命令添加 yum 仓库地址。
- [root@localhost ~]# sudo yum-config-manager
- --add-repo
- https://download.docker.com/linux/centos/docker-ce.repo
3.安装docker
- [root@localhost ~]# sudo yum install docker-ce
4.启动 Docker
- [root@localhost ~]# systemctl enable docker
- Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
- [root@localhost ~]# systemctl start docker
5.查看docker版本
- [root@localhost ~]# docker version
- Client: Docker Engine - Community
- Version: 19.03.3
- API version: 1.40
- Go version: go1.12.10
- Git commit: a872fc2f86
- Built: Tue Oct 8 00:58:10 2019
- OS/Arch: linux/amd64
- Experimental: false
- Server: Docker Engine - Community
- Engine:
- Version: 19.03.3
- API version: 1.40 (minimum version 1.12)
- Go version: go1.12.10
- Git commit: a872fc2f86
- Built: Tue Oct 8 00:56:46 2019
- OS/Arch: linux/amd64
- Experimental: false
- containerd:
- Version: 1.2.10
- GitCommit: b34a5c8af56e510852c35414db4c1f4fa6172339
- runc:
- Version: 1.0.0-rc8 dev
- GitCommit: 3e425f80a8c931f88e6d94a8c831b9d5aa481657
- docker-init:
- Version: 0.18.0
- GitCommit: fec3683
- [root@localhost ~]#