Docker服务启动报错Job for docker.service failed because the control process exited with error

Docker服务启动报错:Job for docker.service failed because the control process exited with error

安装docker后,使用命令:systemctl status docker.service 查看启动信息:
在这里插入图片描述

解决办法:

1. 备份数据(生产环境上特别注意)

2.更新仓库

yum -y update

3.启用 ELRepo 仓库

ELRepo 仓库是基于社区的用于企业级 Linux 仓库,提供对 RedHat Enterprise (RHEL) 和 其他基于 RHEL的 Linux 发行版(CentOS、Scientific、Fedora 等)的支持。
ELRepo 聚焦于和硬件相关的软件包,包括文件系统驱动、显卡驱动、网络驱动、声卡驱动和摄像头驱动等。

rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm

4.查看可用的系统内核包

在这里插入图片描述

5.安装最新版内核

yum --enablerepo=elrepo-kernel install kernel-ml

6.设置 grub2

内核安装好后,需要设置为默认启动选项并重启后才会生效

7.查看系统上的所有可用内核

sudo awk -F\' '$1=="menuentry " {print i++ " : " $2}' /etc/grub2.cfg
显示如下:
0 : CentOS Linux (5.4.8-1.el7.elrepo.x86_64) 7 (Core)
1 : CentOS Linux (3.10.0-514.26.2.el7.x86_64) 7 (Core)
2 : CentOS Linux (3.10.0-327.el7.x86_64) 7 (Core)
3 : CentOS Linux (0-rescue-f9d400c5e1e8c3a8209e990d887d4ac1) 7 (Core)

8.设置 grub2

我们要使用 5.4.8-1 这个版本,通过编辑 /etc/default/grub 文件,设置 GRUB_DEFAULT=0,表示使用显示编号为 0 的内核作为默认内核:

 vi /etc/default/grub
 
> GRUB_TIMEOUT=5
> GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
> GRUB_DEFAULT=0
> GRUB_DISABLE_SUBMENU=true
> GRUB_TERMINAL_OUTPUT="console"
> GRUB_CMDLINE_LINUX="crashkernel=auto console=ttyS0 console=tty0 panic=5"
> GRUB_DISABLE_RECOVERY="true"
> GRUB_TERMINAL="serial console"
> GRUB_TERMINAL_OUTPUT="serial console"
> GRUB_SERIAL_COMMAND="serial --speed=9600 --unit=0 --word=8 --parity=no --stop=1"

9.生成 grub 配置文件并重启

通过 gurb2-mkconfig 命令创建 grub2 的配置文件,然后重启

sudo grub2-mkconfig -o /boot/grub2/grub.cfg
sudo reboot

重启后,通过uname -r 命令查看内核版本发现已经生效了
在这里插入图片描述

10. 删除旧内核(可选)

查看系统中全部的内核:

rpm -qa | grep kernel
显示如下:
kernel-tools-libs-3.10.0-514.26.2.el7.x86_64
kernel-ml-5.4.8-1.el7.elrepo.x86_64
kernel-3.10.0-327.el7.x86_64
kernel-tools-3.10.0-514.26.2.el7.x86_64
kernel-headers-3.10.0-514.26.2.el7.x86_64
kernel-3.10.0-514.26.2.el7.x86_64
使用 yum remove命令删除多余内核
yum remove kernel-tools-libs-3.10.0-514.26.2.el7.x86_64 kernel-3.10.0-327.el7.x86_64 kernel-tools-3.10.0-514.26.2.el7.x86_64 kernel-headers-3.10.0-514.26.2.el7.x86_64 kernel-3.10.0-514.26.2.el7.x86_64
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值