CentOs6和Centos7安装docker

Posted java-jiangtao-home

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOs6和Centos7安装docker相关的知识,希望对你有一定的参考价值。

Centos6安装的时候是按照网上的步骤,

yum install -y epel-release

yum install -y docker -io

service docker start

失败了,说是未被识别的服务,接下来

yum remove docker

yum remove docker-io

vi  /etc/yum.repos.d/docker.repo

放入下面的内容

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
 
---------------------------分割线---------------------------
 
yum install docker-engine
 
service docker start
ok,启动成功
CentOs7安装与CentOs6差不多,
有个答案是先移除安装的和docker相关的东西
 

yum remove docker
yum remove docker-selinux

vi  /etc/yum.repos.d/docker.repo

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1

---------------------------分割线---------------------------
 
yum install docker-engine
 
service docker start

但是会报这样的错

[[email protected] ~]# service docker start
Redirecting to /bin/systemctl start docker.service
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details

我感觉应该是没有卸载干净,我是把虚拟机删除重新导入,按照上面的方式安装成功(如下):

vi  /etc/yum.repos.d/docker.repo

放入下面的内容

[dockerrepo]
name=Docker Repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
 
---------------------------分割线---------------------------
 
yum install docker-engine
 
service docker start

 

 

 

 

 

 

以上是关于CentOs6和Centos7安装docker的主要内容,如果未能解决你的问题,请参考以下文章

CentOS7安装Docker

centos6.5 安装docker方法

Centos6.5安装和使用docker

Centos7安装Docker

docker安装

Centos6.7安装docker1.7.1