安装docker
#1、卸载旧的版本
yum remove docker \
docker-client \
docker-client-latest \
docker-common \
docker-latest \
docker-latest-logrotate \
docker-logrotate \
docker-engine
#2、需要的安装包
yum install -y yum-utils
#3、设置镜像的仓库(阿里云的)
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
#4、更新yum软件包索引
yum makecache fast
#5、安装docker
yum install docker-ce docker-ce-cli containerd.io
#6、启动docker
systemctl start docker
#7、查看是否安装成功
docker version
#8、用docker运行helloworld
docker run hello-world
阿里云镜像加速
- 登录阿里云官网,进入控制台
- 在产品与服务里找到容器镜像服务,点击镜像加速器,然后便可以按照官方的步骤来了