Docker Engine Install on CentOS
- 2022-10-03 14:05:00
- pjd
- 原创 425
不是 root 用户,所有命令前添加 sudo
查看当前的内核版本, 官方建议 3.10 以上
uname -r
Uninstall old version
sudo yum remove docker \ docker-client \ docker-client-latest \ docker-common \ docker-latest \ docker-latest-logrotate \ docker-logrotate \ docker-engine
安装需要的软件包
yum install -y yum-utils device-mapper-persistent-data lvm2
设置yum安装源
yum-config-manager --add-repo http://download.docker.com/linux/centos/docker-ce.repo(中央仓库) yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo(国内建议安装阿里仓库)
查看可用版本有哪些
yum list docker-ce --showduplicates | sort -r
选择一个版本并安装
yum install docker-ce-版本号
yum install -y docker-ce docker-ce-cli http://containerd.io
启动 Docker
systemctl start docker
设置开机自启
systemctl enable docker
测试docker是否安装成功
docker -v
[root@xxxxx~]# docker -v
Docker version 20.10.17, build 100c701
[root@xxxxx ~]# docker version
Client: Docker Engine - Community
Version: 20.10.17
API version: 1.41
Go version: go1.17.11
Git commit: 100c701
Built: Mon Jun 6 23:03:11 2022
OS/Arch: linux/amd64
Context: default
Experimental: true
Server: Docker Engine - Community
Engine:
Version: 20.10.17
API version: 1.41 (minimum version 1.12)
Go version: go1.17.11
Git commit: a89b842
Built: Mon Jun 6 23:01:29 2022
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: 1.6.6
GitCommit: 10c12954828e7c7c9b6e0ea9b0c02b01407d3ae1
runc:
Version: 1.1.2
GitCommit: v1.1.2-0-ga916309
docker-init:
Version: 0.19.0
GitCommit: de40ad0