当前位置:   article > 正文

【亲测有效】Centos安装完成docker后启动docker报错docker: unrecognized service的两种解决方案_start: unrecognized service

start: unrecognized service

使用yum install docker安装完后启动不了,报错如下:
[root@Sakura ~]#

service docker start 
  • 1

docker: unrecognized service

一直停留在以上步骤,如果有遇到和我一样类似问题的小伙伴可以按照如下方法进行安装,即可安装成功~~

方法一:

  • 先移除docker

[root@Sakura ~]#

yum remove docker
  • 1

再移除docker-selinux(如果你之前有安装过的话)

[root@Sakura ~]#

yum remove docker-selinux
  • 1

然后修改文件

[root@Sakura ~]#

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

直接填入如下内容:

[dockerrepo]

name=Docker Repository

baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/

enabled=1

gpgcheck=1

gpgkey=https://yum.dockerproject.org/gpg
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 然后启动安装:

[root@Sakura ~]#

 yum install docker-engine
  • 1

作为依赖被安装: docker-engine-selinux.noarch 0:1.10.2-1.el7.centos

然后启动docker服务:

[root@Sakura ~]#

service docker start
  • 1

返回如下状态码:

Starting cgconfig service: [ OK ]
Starting docker: [ OK ]

即可完美的使docker启动成功!!!

方法二:

直接用这条命令安装

[root@Sakura ~]#

curl -fsSL https://get.docker.com/ | sh + sh -c 'sleep 3; yum -y -q install docker-engine'
  • 1

可能会有以下提示信息,我们不需要去管:

警告:/var/cache/yum/x86_64/7/docker-main-repo/packages/docker-engine-selinux-1.10.2-1.el7.centos.noarch.rpm: 头V4 RSA/SHA512 Signature, 密钥 ID 2c52609d: NOKEY docker-engine-selinux-1.10.2-1.el7.centos.noarch.rpm 的公钥尚未安装 导入 GPG key 0x2C52609D: 用户ID : "Docker Release Tool (releasedocker) " 指纹 : 5811 8e89 f3a9 1289 7c07 0adb f762 2157 2c52 609d 来自 : https://yum.dockerproject.org/gpg setsebool: SELinux is disabled. + sh -c 'docker version' Client: Version: 1.10.2 API version: 1.22 Go version: go1.5.3 Git commit: c3959b1 Built: Mon Feb 22 16:16:33 2016 OS/Arch: linux/amd64 Cannot connect to the Docker daemon. Is the docker daemon running on this host? If you would like to use Docker as a non-root user, you should now consider adding your user to the "docker" group with something like: sudo usermod -aG docker your-user Remember that you will have to log out and back in for this to take effect!
  • 1

然后直接启动就好了~~~

[root@Sakura ~]#

service docker start Redirecting to /bin/systemctl start docker.service
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/197592
推荐阅读
相关标签
  

闽ICP备14008679号