docker安装
1、官方安装文档:https://docs.docker.com/install/linux/docker-ce/centos/#upgrade-docker-after-using-the-convenience-script
下面是官方文档中的步骤:
#1、操作系统必须在centos7内核版本3.10以上,通过cat /proc/version 查看内核版本
#2、安装需要的软件包, yum-util 提供yum-config-manager功能,另外两个是devicemapper驱动依赖的
sudo yum install -y yum-utils device-mapper-persistent-data lvm2
#3、安装docker的yum源
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
#4、指定版本安装docker组件(测试中不指定如下版本安装后会出现无法运行容器的情况),下载需要时间,最好在screen下安装
yum install -y docker-ce-18.09.0-3.el7 docker-ce-cli-18.09.0-3.el7 containerd.io-1.2.0-3.el7
#4.1 亚马逊云主机安装过程出现error:
Error: Package: docker-ce-17.12.0.ce-1.el7.centos.x86_64 (docker-ce-stable) Requires: container-selinux >= 2.9
解决方法:
#下载container-selinux wget http://mirrors.atosworldline.com/public/centos/7/extras/x86_64/Packages/container-selinux-2.68-1.el7.noarch.rpm #安装 rpm -ivh container-selinux-2.68-1.el7.noarch.rpm --nodeps --force
#5、安装完成后设置启动
systemctl enable docker
systemctl start docker
测试一个镜像
docker image pull library/hello-world
docker run hello-world

浙公网安备 33010602011771号