内核3.10,systemctl start docker 被阻塞,没有返回,查看状态为启动中。

某兄弟机器安装docker之后,发现systemctl start docker的时候阻塞,由于排查走了一些弯路,记录如下:

level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
level=info msg="libcontainerd: new containerd process, pid: 46803"
level=warning msg="Docker could not enable SELinux on the host system"
level=info msg="Graph migration to content-addressability took 0.00 seconds"
level=info msg="Loading containers: start."
level=warning msg="Running modprobe nf_nat failed with message: ``, error: exec: \"modprobe\": executable file not found in $PATH"
level=warning msg="Running modprobe xt_conntrack failed with message: ``, error: exec: \"modprobe\": executable file not found in $PATH"
level=info msg="Firewalld running: false"
Error starting daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain: iptables failed: iptables --wait -t nat -N DOCKER: iptables v
Perhaps iptables or your kernel needs to be upgraded.
(exit status 3)
 docker.service: main process exited, code=exited, status=1/FAILURE
 Failed to start Docker Application Container Engine.

根据错误记录,确定是创建iptable的链路规则失败,然后查看iptables --list,会报 获取锁失败,

[root@custom-16-126 ~]# iptables --list
Another app is currently holding the xtables lock. Perhaps you want to use the -w option

这种情况一般是前面拿锁写规则的iptables进程没有返回,ps -ef 查看对应的进程,发现如下:

[root@custom-16-126 ~]# ps -ef |grep -i iptables
root 14967 14926 0 20:05 ? 00:00:00 /usr/sbin/iptables --wait -t nat -D PREROUTING -m addrtype --dst-type LOCAL -j DOCKER

iptables进程确实没有返回,

查看对应的堆栈和内核代码,确定nat模块需要依赖对应的conntrack模块:

int nf_nat_l3proto_register(const struct nf_nat_l3proto *l3proto)
{
    int err;

err = nf_ct_l3proto_try_module_get(l3proto->l3proto);

然后看对应为什么没有加载nf_conntrack-2,发现该环境上的nf_conntrack-2 被backlist了。

另外注意到一个很有趣的问题,在打点测试的时候,发现如下代码:

nf_ct_l3proto_try_module_get(unsigned short l3proto)
{
    int ret;
    struct nf_conntrack_l3proto *p;
retry:  p = nf_ct_l3proto_find_get(l3proto);
    if (p == &nf_conntrack_l3proto_generic) {
        ret = request_module("nf_conntrack-%d", l3proto);
        if (!ret)
            goto retry;
        return -EPROTOTYPE;
    }
    return 0;
}
这里retry应该是有问题的,如果request的nf_conntrack模块被backlist,则会出现一直不退出的情况,而这个流程中会不停提交work_struct到workqueue中,大量的无效work被执行。

docker启动失败问题的更多相关文章

  1. centos7下docker启动失败解决

    docker启动失败解决 could not change group /var/run/docker.sock to docker: gr... not found 如果出现:Job for doc ...

  2. docker启动失败如何查看容器日志

    docker启动失败如何查看容器日志 在使用docker的时候,在某些未知的情况下可能启动了容器,但是过了没几秒容器自动退出了.这个时候如何排查问题呢? 通常碰到这种情况无非就是环境有问题或者应用有问 ...

  3. selinux导致docker启动失败

    1. 问题描述:一向运行正常的一群容器,突然有一天挂掉了,再也起不来,报错如下 Error response from daemon: devmapper: Error mounting '/dev/ ...

  4. SELinux 引起的 Docker 启动失败

    问题描述 Linux OS 版本 CentOS Linux release 7.2.1511 (Core) 启动Docker service docker start 启动失败信息 原因分析 Erro ...

  5. docker 启动失败 Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

    CentOS7安装docker,安装成功后,启动失败 提示: 我们可以看到此处它提示是Failed to start Docker Application Container Engine. 于是在网 ...

  6. SELinux导致的docker启动失败

    安装docker yum install -y docker 启动docker systemctl start docker 报错 Job for docker.service failed beca ...

  7. DOCKER启动失败Job for docker.service failed because the control process exited with error code. See "syste mctl status docker.service" and "journalctl -xe" for details.

    [root@localhost ~]# systemctl start docker Job for docker.service failed because the control process ...

  8. Docker启动失败

    报错信息: Job for docker.service failed because the control process exited with error code. See "sy ...

  9. Docker 启动失败Starting docker (via systemctl): Job for docker.service failed

    Starting docker (via systemctl):  Job for docker.service failed. See 'systemctl status docker.servic ...

随机推荐

  1. Bean Validator

    Bean Validator 关于Jakarta EE 2018年03月, Oracle 决定把 JavaEE 移交给开源组织 Eclipse 基金会,并且不再使用Java EE这个名称. 因此jav ...

  2. 2021.06.12【NOIP提高B组】模拟 总结

    T1 题目大意:有 \(n\) 个点,到点 \(i\) 可以获得 \(A_i\) ,同时消耗 \(B_i\) 若当前价值小于 \(B_i\) 则不能到,问从 \(P\) 开始,任一点结束后的最大值. ...

  3. C语言- 基础数据结构和算法 - 栈的链式存储

    听黑马程序员教程<基础数据结构和算法 (C版本)>, 照着老师所讲抄的, 视频地址https://www.bilibili.com/video/BV1vE411f7Jh?p=1 喜欢的朋友 ...

  4. Lucene从入门到实战

    Lucene 在了解Lucene之前,我们先了解下全文数据查询. 全文数据查询 我们的数据一般分为两种:结构化数据和非结构化数据 结构化数据:有固定格式或有限长度的数据,如数据库中的数据.元数据 非结 ...

  5. 【Redis】Redis Cluster-集群故障转移

    集群故障转移 节点下线 在集群定时任务clusterCron中,会遍历集群中的节点,对每个节点进行检查,判断节点是否下线.与节点下线相关的状态有两个,分别为CLUSTER_NODE_PFAIL和CLU ...

  6. sql-DQL-多表联查

    多表查询 笛卡尔积 左表的每条数据和右表的每条数据组合,这种效果称为笛卡尔乘积 select * from emp, dept; 笛卡尔积引入了很多无用的数据,要完成多表查询,需要设置过滤条件来消除无 ...

  7. jQuery获取市、区县、乡镇、村

    效果图: 首先根据自己方法把地区树状结构json字符串拿到 html下拉框和js写法如下: <select class="form-control" style=" ...

  8. Tensorflow2 深度学习十必知

    博主根据自身多年的深度学习算法研发经验,整理分享以下十条必知. 含参考资料链接,部分附上相关代码实现. 独乐乐不如众乐乐,希望对各位看客有所帮助. 待回头有时间再展开细节说一说深度学习里的那些道道. ...

  9. 虚拟机启动时报’A start job is running for /etc/rc.local .. Compatibility错误。

    虚拟机启动时报'A start job is running for /etc/rc.local .. Compatibility错误. 问题已经存在很长时间了,但是不影响ssh登录,遂置之未理. 经 ...

  10. Java之取余操作 "%"

    取模运算与取余运算两个概念有重叠的部分但又不完全一致.主要的区别在于对负整数进行除法运算时操作不同. 对于整形数a,b来说,取模运算或者求余运算的方法都是: 1.求 整数商 c = a / b: 2. ...