CentOS7安装docker的详细步骤

前提条件:目前,CentOS 仅发行版本中的内核支持 Docker。

Docker 运行在CentOS 7 上,要求系统为64位、系统内核版本为 3.10 以上。

Docker 运行在 CentOS-6.5 或更高的版本的 CentOS 上,要求系统为64位、系统内核版本为 2.6.32-431 或者更高版本。

使用 yum 安装(CentOS 7下)

Docker 要求CentOS 系统的内核版本高于 3.10 ,查看本页面的前提条件来验证你的CentOS 版本是否支持 Docker 。

通过uname -r 命令查看你当前的内核版本。

满足条件后,下面开始正式安装步骤:

1、更新yum:

sudo yum update

更新过程中有提示,输入“y”:

2、更新完成,执行docker安装脚本:

curl -sSL https://get.docker.com/ | sh

3. 启动docker服务:

sudo service docker start 

4、测试docker安装是否完成:docker run hello-world

5、查看docker版本:docker version

Docker安装成功之后,安装docker compse

使用python-pip进行安装

首先检查centos7中有没有安装过python-pip包,命令如下:

pip -V

 运行结果:

没有python-pip包就执行如下命令安装epel-release依赖:

yum -y install epel-release

运行结果:

执行成功以后,接着执行如下命令安装python-pip:

yum -y install python-pip

   运行结果:

对上步中安装好的pip组件进行升级,命令如下:

sudo pip install --upgrade pip

   运行结果:

再次执行如下命令,检查pip环境:

pip -V

   运行结果:

执行如下命令,安装Docker-Compose:

sudo pip install docker-compose

安装过程中如果出现如下错误:

Cannot uninstall ‘requests’. It is adistutils installed project and thus we cannot accurately determine which filesbelong to it which would lead to only a partial uninstall.

解决办法:pip install docker-compose--ignore-installed requests

没有任何错误,会出现如下安装成功界面:

亲测有效

源博客:https://www.jianshu.com/p/dcf61276efa9

猜你喜欢

转载自blog.csdn.net/qq_41936224/article/details/107067558