Docker【 CentOS 安装Docker】

一、安装
1.安装前查看Linux版本
  • Docker要求linux的内核版本高于的3.10
uname -r

在这里插入图片描述

2、如果安装过需要卸载
  • 命令如下:
sudo yum remove docker-ce docker-ce-selinux container-selinux
                  docker \
                  docker-client \
                  docker-client-latest \
                  docker-common \
                  docker-latest \
                  docker-latest-logrotate \
                  docker-logrotate \
                  docker-selinux \
                  docker-engine-selinux \
                  docker-engine

在这里插入图片描述在这里插入图片描述

3、安装相关依赖

安装必须的包。yum-utils提供了yum-config-manager实用程序,并且device-mapper-persistent-data和lvm2需要devicemapper存储驱动程序

sudo yum install -y yum-utils device-mapper-persistent-data lvm2
4、添加软件源

建议使用阿里云镜像

sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
sudo yum makecache fast
5、安装
sudo yum install docker-ce

在这里插入图片描述

6、启动
sudo systemctl start docker
7、报错解决

报错如下:

Job for docker.service failed because the control process exited with error code. See "systemctl sta

mkfs.xfs版本太低,更新命令:
yum update xfsprogs

8、启动HelloWorld

第一次启动helloworld 因为本地没有镜像会从远程仓库拉取镜像。

sudo docker run hello-world

hello

二、配置镜像加速器
1、DaoCloud镜像站

网址 :DaoCloud
在这里插入图片描述

2、阿里云镜像加速器

这个我们需要注册阿里云的账号,然后在管理中心找到镜像加速器进行相应配置。

发布了122 篇原创文章 · 获赞 32 · 访问量 9万+

猜你喜欢

转载自blog.csdn.net/YangzaiLeHeHe/article/details/99594568