直接上代码 五分钟运行hello-world
一 检查CentOS 版本
[root@iZuf60gzw63rkhznzp414rZ docker]# uname -a Linux iZuf60gzw63rkhznzp414rZ 3.10.0-1127.8.2.el7.x86_64 #1 SMP Tue May 12 16:57:42 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
具体限制,自行百度
二 更新yum 包
yum update //中间ji'd
二 安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的
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(推荐 阿里仓库)
四 可以查看所有仓库中所有docker版本,并选择特定版本安装
yum list docker-ce --showduplicates | sort -r
五 安装Docker,命令:yum install docker-ce-版本号,我选的是docker-ce-18.03.1.ce
yum install docker-ce-18.03.1.ce
六 启动Docker,命令:systemctl start docker,然后加入开机启动
systemctl start docker systemctl enable docker
运行helloworld
docker pull hello-world docker run hello-world