2024年笔记--centos docker离线安装启动失败

news/2025/2/15 16:29:55/

Failed to start Docker Application Container Engine

错误如下:

[root@el70 docker]# systemctl start docker.service
Job for docker.service failed because start of the service was attempted too often. See "systemctl status docker.service" and "journalctl -xe" for details.
To force a start use "systemctl reset-failed docker.service" followed by "systemctl start docker.service" again.
[root@el70 docker]# journalctl -xe
Feb 06 16:15:36 el70 dockerd[2524]: time="2024-02-06T16:15:36.044378290+08:00" level=info msg="[core] [Channel #1] Channel deleted" module=grp
Feb 06 16:15:36 el70 dockerd[2524]: time="2024-02-06T16:15:36.044158542+08:00" level=info msg="stopping event stream following graceful shutdo
Feb 06 16:15:36 el70 dockerd[2524]: time="2024-02-06T16:15:36.044822884+08:00" level=info msg="[core] [Channel #7 SubChannel #8] Subchannel Co
Feb 06 16:15:36 el70 dockerd[2524]: time="2024-02-06T16:15:36.044928467+08:00" level=info msg="[core] [Channel #7] Channel Connectivity change
Feb 06 16:15:37 el70 dockerd[2524]: failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Fa
Feb 06 16:15:37 el70 systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
Feb 06 16:15:37 el70 systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has failed.
-- 
-- The result is failed.
Feb 06 16:15:37 el70 systemd[1]: Unit docker.service entered failed state.
Feb 06 16:15:37 el70 systemd[1]: docker.service failed.
Feb 06 16:15:37 el70 systemd[1]: docker.service holdoff time over, scheduling restart.
Feb 06 16:15:37 el70 systemd[1]: Stopped Docker Application Container Engine.
-- Subject: Unit docker.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit docker.service has finished shutting down.
Feb 06 16:15:37 el70 systemd[1]: start request repeated too quickly for docker.service
Feb 06 16:15:37 el70 systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

解决分析过程:

再打开一个ssh连接窗口,执行命令tail -200f /var/log/messages

然后在原窗口中执行 systemctl start docker   观察新窗口中的日志。

我这里看到的有关错误日志内容如下:

Feb  6 16:22:54 el70 firewalld: 2024-02-06 16:22:54 ERROR: INVALID_TYPE: structure size mismatch 16 != 13
Feb  6 16:22:54 el70 firewalld: 2024-02-06 16:22:54 ERROR: COMMAND_FAILED: '/sbin/iptables -t filter -C FORWARD -j DOCKER-ISOLATION' failed: iptables v1.4.21: Couldn't load target `DOCKER-ISOLATION':No such file or directory

Try `iptables -h' or 'iptables --help' for more information.
Feb  6 16:22:54 el70 firewalld: 2024-02-06 16:22:54 ERROR: COMMAND_FAILED: '/sbin/iptables -t nat -D PREROUTING -m addrtype --dst-type LOCAL -j DOCKER' failed: iptables: No chain/target/match by that name.
Feb  6 16:22:54 el70 firewalld: 2024-02-06 16:22:54 ERROR: COMMAND_FAILED: '/sbin/iptables -t nat -D OUTPUT -m addrtype --dst-type LOCAL ! --dst 127.0.0.0/8 -j DOCKER' failed: iptables: No chain/target/match by that name.

然后我尝试:

[root@el70 docker]# service iptables stop         
Redirecting to /bin/systemctl stop  iptables.service
Failed to stop iptables.service: Unit iptables.service not loaded.

原来这个服务不存在,因为我的环境不需要防火墙,因此,我直接执行service firewalld stop 将防火墙关闭。

再次systemctl start docker   启动正常。

---------------------------------

其他错误,修改/etc/docker/daemon.json后,重启docker失败

启动失败,错误为:Feb  6 16:37:34 el70 systemd: Starting Docker Application Container Engine...
Feb  6 16:37:34 el70 dockerd: unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives are specified both as a flag and in the configuration file: insecure-registries: (from flag: [127.0.0.1], from file: [xx.xx.xx.xx:8080])

原因:

因为修改了/etc/docker/daemon.json 内容为如下
{
"insecure-registries":["xx.xx.xx.xx:8080"]
}

而/etc/systemd/system/docker.service 中也配置了ExecStart=/usr/bin/dockerd --selinux-enabled=false --insecure-registry=xx.xx.xx.xx:8080

将ExecStart这一行修改为:

ExecStart=/usr/bin/dockerd --selinux-enabled=false

然后systemctl daemon-reload ,再次 systemctl start docker即可启动

----------

其他错误2:

Feb  6 17:12:34 el70 dockerd: time="2024-02-06T17:12:34.353598727+08:00" level=error msg="Download failed after 1 attempts: error parsing HTTP 408 response body: invalid character '<' looking for beginning of value: \"<html><body><h1>408 Request Time-out</h1>\\nYour browser didn't send a complete request in time.\\n</body></html>

解决方法:

修改配置文件 /etc/docker/daemon.json 增加

"registry-mirrors": ["http://hub-mirror.c.163.com"]

修改后的全内容为:

{
"insecure-registries":["xx.xx.xx.xx:8080"],
"registry-mirrors": ["http://hub-mirror.c.163.com"]
}

然后重启docker服务,有时候失败了要先执行一下systemctl reset-failed docker.service 清理掉失败状态。再进行systemctl start docker尝试。

参考文章:

Docker启动失败报错Failed to start Docker Application Container Engine的解决办法_docker_脚本之家


http://www.ppmy.cn/news/1350710.html

相关文章

【ASP.NET Core 基础知识】--测试--单元测试和集成测试

一、单元测试 1.1 单元测试概述 单元测试是软件开发中的一种测试方法&#xff0c;用于验证软件中的最小可测试单元——通常是函数、方法或类——的行为是否符合预期。它的核心思想是将程序分解成独立的单元&#xff0c;并针对每个单元编写测试用例&#xff0c;以验证其功能是…

蓝桥杯嵌入式第9届真题(完成) STM32G431

蓝桥杯嵌入式第9届真题(完成) STM32G431 题目 分析和代码 main.h /* USER CODE BEGIN Header */ /********************************************************************************* file : main.h* brief : Header for main.c file.* …

[145] 二叉树的后序遍历 js

题目描述&#xff1a;给你一棵二叉树的根节点 root &#xff0c;返回其节点值的 后序遍历 解题思路&#xff1a; 迭代法&#xff1a; 后序&#xff08;左右根&#xff09; 先序是根左右 后序是左右根 后序翻转一下就是 根右左 所以后序的结果实际就是 先序的方法&#xff0…

虚拟飞控计算机:飞行控制系统验证与优化的利器

01.背景介绍 随着航空技术的飞速发展&#xff0c;飞行控制系统作为飞机的心脏&#xff0c;全面负责监测、调整和维持飞行器的姿态、航向、高度等参数&#xff0c;用以确保飞行的安全和稳定。为了满足这些要求&#xff0c;现代飞控系统通常采用先进的处理器和外设来确保其高效、…

深度解析与推荐:主流Web前端开发框架

一、引言 在信息化社会中,Web前端开发的重要性日益凸显。作为连接用户与后台服务的关键桥梁,前端界面不仅直接影响用户体验,更是企业品牌形象、产品价值传递的重要载体。随着互联网技术的飞速发展,用户对于网站和应用的交互性、响应速度以及视觉效果等方面的要求越来越高,…

Django从入门到放弃

Django从入门到放弃 Django最初被设计用于具有快速开发需求的新闻类站点&#xff0c;目的是实现简单快捷的网站开发。 安装Django 使用anaconda创建环境 conda create -n django_env python3.10 conda activate django_env使用pip安装django python -m pip install Django查…

Centos7安装nginx yum报错

Centos7安装nginx yum报错&#xff0c;yum源报错解决办法&#xff1a; 1、更新epel源后&#xff0c;出现yum报错 [roothacker117 ~]# yum install epel-release&#xff08;安装成功&#xff09; [roothacker117 ~]# yum install nginx&#xff08;安装失败&#xff0c;提示如…

Unity下使用Sqlite

sqlite和access类似是文件形式的数据库&#xff0c;不需要安装任何服务&#xff0c;可以存储数据&#xff0c;使用起来还是挺方便的。 首先需要安装DLL 需要的DLL 我们找到下面两个文件放入Plugins目录 Mono.Data.Sqlite.dll System.Data.dll DLL文件位于Unity的安装目录下的…