docker启动报错Job for docker.service failed because the control process exited with error code. See “sy

报错现象

[root@localhost svn]# systemctl start docker
Job for docker.service failed because the control process exited with error code. 
See "systemctl status docker.service" and "journalctl -xe" for details.

查看状态

[root@localhost run]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since 四 2021-01-07 15:53:28 CST; 4s ago
     Docs: http://docs.docker.com
  Process: 23211 ExecStart=/usr/bin/dockerd-current --add-runtime docker-runc=/usr/libexec/docker/docker-runc-current --default-runtime=docker-runc --exec-opt native.cgroupdriver=systemd --userland-proxy-path=/usr/libexec/docker/docker-proxy-current --init-path=/usr/libexec/docker/docker-init-current --seccomp-profile=/etc/docker/seccomp.json $OPTIONS $DOCKER_STORAGE_OPTIONS $DOCKER_NETWORK_OPTIONS $ADD_REGISTRY $BLOCK_REGISTRY $INSECURE_REGISTRY $REGISTRIES (code=exited, status=1/FAILURE)
 Main PID: 23211 (code=exited, status=1/FAILURE)

17 15:53:26 localhost systemd[1]: Starting Docker Application Container Engine...
  . 10 15:53:27 localhost dockerd-current[23211]: time="2021-01-07T15:53:27.013309303+08:00" level=warning msg="c...ound"
17 15:53:27 localhost dockerd-current[23211]: time="2021-01-07T15:53:27.014757322+08:00" level=info msg="libc...3220"
17 15:53:28 localhost dockerd-current[23211]: Error starting daemon: SELinux is not supported with the overlay2 graph driver on this kernel. Either boot into a newer kernel or disable selinux in docker
    17 15:53:28 localhost systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
    17 15:53:28 localhost systemd[1]: Failed to start Docker Application Container Engine.
    17 15:53:28 localhost systemd[1]: Unit docker.service entered failed state.
    17 15:53:28 localhost systemd[1]: docker.service failed.
    Hint: Some lines were ellipsized, use -l to show in full.

发现其显示问题所在:

107 15:53:28 localhost dockerd-current[23211]: Error starting daemon: 
SELinux is not supported with the overlay2 graph driver on this kernel.
 Either boot into a newer kernel or disable selinux in docker

大意是:这个内核的SELinux不支持overlay2图形驱动,要么更新内核或者关掉SELinux。

解决办法:

rm -rf /var/lib/docker/
[root@localhost run]# vim /etc/sysconfig/docker
# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS=' --selinux-enabled--log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

将–selinux-enabled后添加=false,

[root@localhost run]# vim /etc/sysconfig/docker
# /etc/sysconfig/docker

# Modify these options if you want to change the way the docker daemon runs
OPTIONS='--selinux-enabled=false --log-driver=journald --signature-verification=false'
if [ -z "${DOCKER_CERT_PATH}" ]; then
    DOCKER_CERT_PATH=/etc/docker
fi

重新启动 0k

### 解决CentOS 8 Docker服务启动失败问题 当遇到`docker.service`无法正常启动的情况时,通常会伴随错误日志提示控制进程退出并带有错误码。对于此类问题,可以采取一系列措施来排查和修复。 #### 检查现有配置和服务状态 为了更好地理解具体原因,建议先查看当前系统的Docker服务状态以及任何可能存在的故障记录: ```bash $ systemctl status docker.service ``` 如果发现有类似于`control process exited with error code`的信息,则表明存在某些阻碍Docker成功初始化的因素[^1]。 #### 验证依赖项安装情况 确认是否已经正确设置了官方YUM仓库地址用于获取最新版本的Docker CE包文件,并执行更新操作以确保所有必要的组件都处于最新状态: ```bash $ sudo yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo $ sudo yum makecache fast $ sudo yum install -y docker-ce docker-ce-cli containerd.io ``` 上述命令序列可以帮助建立正确的软件源链接并完成基础环境搭建工作[^2]。 #### 排除内核模块加载异常的影响 有时由于缺少特定驱动程序的支持或是其他因素干扰到了核心功能模块的成功装载,这也会间接影响到容器引擎的表现形式。因此有必要进一步调查是否有与此关联的任务未能顺利完成: ```bash $ systemctl --state=failed | grep systemd-modules-load.service ``` 一旦识别出确实存在问题的地方,可以根据实际情况调整相应的引导参数或者尝试重新编译定制化的Linux kernel image来解决问题[^3]。 通过以上几个方面的综合考量与处理手段的应用,应该能够有效缓解乃至彻底消除因各种潜在隐患所引发的一系列连锁反应,从而让Docker能够在CentOS 8平台上稳定运行起来。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值