欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

CentOS7 安装docker 解决启动不了的问题

程序员文章站 2023-11-18 22:44:34
 centos7安装docker 启动不了,在工作当中遇到这个问题,当时急的不清,网上资料又不多,不过经过自己的捣鼓终于解决了 这个问题! [root...

 centos7安装docker 启动不了,在工作当中遇到这个问题,当时急的不清,网上资料又不多,不过经过自己的捣鼓终于解决了

这个问题!

[root@test ~]# yum update

[root@test ~]# yum install docker

 

[root@test ~]# 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.

[root@test ~]# systemctl status docker.service

● docker.service - docker application container engine

  loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)

  active: inactive (dead) (result: exit-code) since 四 2016-03-10 13:01:21 cst; 7s ago

   docs: http://docs.docker.com

 process: 29939 execstart=/usr/bin/docker daemon $options $docker_storage_options $docker_network_options $add_registry $block_registry $insecure_registry (code=exited, status=2)

 main pid: 29939 (code=exited, status=2)

  cgroup: /system.slice/docker.service

      └─29970 mkfs.ext4 -e nodiscard,lazy_itable_init=0,lazy_journal_ini...

3月 10 13:01:20 test.mayocase.com systemd[1]: failed to start docker applic....

3月 10 13:01:20 test.mayocase.com systemd[1]: unit docker.service entered f....

3月 10 13:01:20 test.mayocase.com systemd[1]: docker.service failed.

3月 10 13:01:21 test.mayocase.com systemd[1]: docker.service holdoff time o....

hint: some lines were ellipsized, use -l to show in full.

[root@test ~]#

使用yum install docker安装完后启动不了

[root@apptest ~]# service docker start
redirecting to /bin/systemctl start docker.service

一直停留在以上步骤

可以使用以下命令来安装,即可成功。

一个问题让我折腾了两天,试过关闭防火墙,关闭selinux,重装系统,等等网上能查到的方法都解决不了。

如果大家解决了,回复感谢下我吧。

[root@apptest ~]# yum remove docker
[root@apptest ~]# yum remove docker-selinux
 
[root@test yum.repos.d]# vi /etc/yum.repos.d/docker.repo
 
[dockerrepo]
name=docker repository
baseurl=https://yum.dockerproject.org/repo/main/centos/$releasever/
enabled=1
gpgcheck=1
gpgkey=https://yum.dockerproject.org/gpg
 
[root@test yum.repos.d]# yum install docker-engine
 

已安装:

  docker-engine.x86_64 0:1.10.2-1.el7.centos                                     

作为依赖被安装:

  docker-engine-selinux.noarch 0:1.10.2-1.el7.centos   

[root@apptest ~]# service docker start
redirecting to /bin/systemctl start docker.service
[root@apptest ~]# docker images
repository     tag         image id      created       size
 
[root@test yum.repos.d]# 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
 
server:
 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
[root@test yum.repos.d]# 

 或者使用以下方法

[root@apptest ~]# curl -fssl https://get.docker.com/ | sh
+ sh -c 'sleep 3; yum -y -q install docker-engine'
警告:/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) <docker@docker.com>"
 指纹    : 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!
 
[root@apptest ~]# 
 
[root@apptest ~]# service docker start
redirecting to /bin/systemctl start docker.service
[root@apptest ~]# docker images
repository     tag         image id      created       size
[root@apptest ~]# 

 感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!