Docker启动时的报错汇总

22017.11.10 16:30:29字数 575阅读 27184

八个Docker常见故障

https://mp.weixin.qq.com/s/2GNKmRJtBGHhUyVBRbRgeA

八个Docker常见故障

报错一:error initializing graphdriver

Docker启动报错

系统是CentOS 7.2
系统内核及docker版本如下 :

[root@docker ~]# uname -r
3.10.0-327.el7.x86_64
[root@docker ~]#
[root@docker ~]#
[root@docker ~]#
[root@docker ~]# docker version
Client:
Version: 18.04.0-ce
API version: 1.37
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:21:36 2018
OS/Arch: linux/amd64
Experimental: false
Orchestrator: swarm Server:
Engine:
Version: 18.04.0-ce
API version: 1.37 (minimum version 1.12)
Go version: go1.9.4
Git commit: 3d479c0
Built: Tue Apr 10 18:25:25 2018
OS/Arch: linux/amd64
Experimental: false

启动报错提示如下 :

[root@docker ~]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journ
[root@docker ~]#
[root@docker ~]#
[root@docker ~]#
[root@docker ~]# systemctl status docker
● docker.service - Docker Application Container Engine
Loaded: loaded (/usr/lib/systemd/system/docker.service; disabled; vendor preset: disabled)
Active: failed (Result: start-limit) since 日 2018-04-22 20:52:39 CST; 5s ago
Docs: https://docs.docker.com
Process: 4810 ExecStart=/usr/bin/dockerd (code=exited, status=1/FAILURE)
Main PID: 4810 (code=exited, status=1/FAILURE) 4月 22 20:52:39 docker.cgy.com systemd[1]: Failed to start Docker Application Container Engine.
4月 22 20:52:39 docker.cgy.com systemd[1]: Unit docker.service entered failed state.
4月 22 20:52:39 docker.cgy.com systemd[1]: docker.service failed.
4月 22 20:52:39 docker.cgy.com systemd[1]: docker.service holdoff time over, scheduling restart.
4月 22 20:52:39 docker.cgy.com systemd[1]: start request repeated too quickly for docker.service
4月 22 20:52:39 docker.cgy.com systemd[1]: Failed to start Docker Application Container Engine.
4月 22 20:52:39 docker.cgy.com systemd[1]: Unit docker.service entered failed state.
4月 22 20:52:39 docker.cgy.com systemd[1]: docker.service failed.

从以上报错提示信息中也没看到错误的具体原因。然后我又用dockerd来直接启动,就在输出信息最下面看到一条错误提示,如下:

[root@docker ~]# dockerd
INFO[2018-04-22T21:12:46.111704443+08:00] libcontainerd: started new docker-containerd process pid=5903
INFO[0000] starting containerd module=containerd revision=773c489c9c1b21a6d78b5c538cd395416ec50f88 version=v1.0.3 。。。。。。省略一部分输出。。。。。。 INFO[0000] loading plugin "io.containerd.grpc.v1.introspection"... module=containerd type=io.containerd.grpc.v1
INFO[0000] serving... address="/var/run/docker/containerd/docker-containerd-debug.sock" module="containerd/debug"
INFO[0000] serving... address="/var/run/docker/containerd/docker-containerd.sock" module="containerd/grpc"
INFO[0000] containerd successfully booted in 0.002763s module=containerd
Error starting daemon: error initializing graphdriver: overlay: the backing xfs filesystem is formatted without d_type support, which leads to incorrect behavior. Reformat the filesystem with ftype=1 to en d_type support. Backing filesystems without d_type support are not supported.

根据最后的报错Error starting daemon:搜索到这篇博客,得到解决。
https://blog.csdn.net/liu9718214/article/details/79134900

具体解决办法是:

vim /etc/sysconfig/docker
加入如下:

OPTIONS="--selinux-enabled --log-driver=journald --signature-verification=false"

/etc/docker/daemon.json
加入如下内容:

{
"registry-mirrors": ["http://4a1df5ef.m.daocloud.io"], # 是用来pull容器加速用的,跟此次问题无关。
"storage-driver": "devicemapper" # 解决此次问题
}

然后重启docker,顺利解决:

[root@docker ~]# systemctl restart docker
[root@docker ~]#
[root@docker ~]#
[root@docker ~]# ps aux | grep docker
root 5922 1.7 1.6 528432 62568 ? Ssl 21:15 0:00 /usr/bin/dockerd
root 5927 1.1 0.5 356984 22100 ? Ssl 21:15 0:00 docker-containerd --config /var/run/docker/containerd/containerd.toml
root 6028 0.0 0.0 112664 964 pts/0 S+ 21:15 0:00 grep --color=auto docker

报错二:iptables failed

FirewallD

CentOS-7 中介绍了 firewalld,firewall的底层是使用iptables进行数据过滤,建立在iptables之上,这可能会与 Docker 产生冲突。

当 firewalld 启动或者重启的时候,将会从 iptables 中移除 DOCKER 的规则,从而影响了 Docker 的正常工作。

当你使用的是 Systemd 的时候, firewalld 会在 Docker 之前启动,但是如果你在 Docker 启动之后再启动 或者重启 firewalld ,你就需要重启 Docker 进程了。

系统:

[root@controller ~]# cat /etc/redhat-release
CentOS Linux release 7.0.1406 (Core)

报错提示如下:

[root@controller ~]# docker run -it -P docker.io/nginx
/usr/bin/docker-current: Error response from daemon: driver failed programming external connectivity on endpoint gloomy_kirch (10289e7a87e65771da90cda531951b7339bee9cb5953474460451cd48013aff0): iptables failed: iptables --wait -t nat -A DOCKER -p tcp -d 0/0 --dport 32810 -j DNAT --to-destination 172.17.0.2:80 ! -i docker0: iptables: No chain/target/match by that name.
(exit status 1).

这是由于在运行这次容器之前,成功启动过一次,在上次访问时,因为防火墙的问题导致不能正常访问Nginx,所以将iptables的filter表清空了,并且重启过iptables,然后再次运行时,就报了以上错误。

解决办法

重启防火墙

#CentOS 7下执行
[root@controller ~]# systemctl restart firewalld

再重启docker守护进程即可

[root@controller ~]# systemctl restart docker

再次在容器中运行一个nginx就不会报错了

[root@controller ~]# docker run -it --name nginx -p 80:80 -v /www:/wwwroot docker.io/nginx /bin/bash
root@a8a92c8f7760:/#

报错三 : Unable to take ownership of thin-pool

docker daemon启动失败:Unable to take ownership of thin-pool

Apr 27 13:51:59 master systemd: Started Docker Storage Setup.
Apr 27 13:51:59 master systemd: Starting Docker Application Container Engine...
Apr 27 13:51:59 master dockerd-current: time="2018-04-27T13:51:59.088441356+08:00" level=warning msg="could not change group /var/run/docker.sock to docker: group docker not found"
Apr 27 13:51:59 master dockerd-current: time="2018-04-27T13:51:59.091166189+08:00" level=info msg="libcontainerd: new containerd process, pid: 20930"
Apr 27 13:52:00 master dockerd-current: Error starting daemon: error initializing graphdriver: devmapper: Unable to take ownership of thin-pool (docker--vg-docker--pool) that already has used data blocks
Apr 27 13:52:00 master systemd: docker.service: main process exited, code=exited, status=1/FAILURE
Apr 27 13:52:00 master systemd: Failed to start Docker Application Container Engine.
Apr 27 13:52:00 master systemd: Unit docker.service entered failed state.
Apr 27 13:52:00 master systemd: docker.service failed

原因: /var/lib/docker/devicemapper/metadata/ 内metadata丢失

workaround:

https://bugzilla.redhat.com/show_bug.cgi?id=1321640#c5

Eric Paris 2016-04-27 08:20:10 EDT

I feel like the kcs kinda misses telling users the actual problem. Nor does it really make it clear the solution.

IF you are using device mapper (instead of loopback) /var/lib/docker contains metadata informing docker about the contents of the device mapper storage area. If you delete /var/lib/docker that metadata is lost. Docker is then able to detect that the thin pool has data but docker is unable to make use of that information. The only solution is to delete the thin pool and recreate it so that both the thin pool and the metadata in /var/lib/docker will be empty.

解决办法:

  1. 执行命令:rm -rf /var/lib/docker/*
  2. 执行命令:rm -rf /etc/sysconfig/docker-storage
  3. 执行命令:lvremove /dev/docker-vg/docker-pool
  4. 使用现有的docker-vg LVM卷组:
cat <<EOF > /etc/sysconfig/docker-storage-setup
VG=docker-vg
EOF
  1. 执行命令:docker-storage-setup
  2. 重启docker即可:systemctl start docker

转载地址:https://www.jianshu.com/p/93518610eea1

docker启动常见报错的更多相关文章

  1. Nginx 常见报错

    Nginx 常见报错 启动报错:[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) 原因:这个是nginx重启时经常遇到 ...

  2. rsync 守护进程模式搭建 与常见报错

    守护进程模式搭建 1.环境准备 2.安装rsync(做备份的服务器都安装) [root@backup ~]# yum install -y rsync 3.服务端配置 [root@backup ~]# ...

  3. web报表工具FineReport使用中遇到的常见报错及解决办法(二)

    web报表工具FineReport使用中遇到的常见报错及解决办法(二) 这里写点抛砖引玉,希望大家能把自己整理的问题及解决方法晾出来,Mark一下,利人利己. 出现问题先搜一下文档上有没有,再看看度娘 ...

  4. java常见报错及解决

    Java常见报错信息: Java 常见异常种类 Java Exception: 1.Error  2.Runtime Exception 运行时异常 3.Exception  4.throw 用户自定 ...

  5. HDFS集群常见报错汇总

    HDFS集群常见报错汇总 作者:尹正杰 版权声明:原创作品,谢绝转载!否则将追究法律责任. 一.DataXceiver error processing WRITE_BLOCK operation 报 ...

  6. 03:git常见报错解决方法

    1.1 git常见报错解决方法 1.warning: LF will be replaced by CRLF in .idea/workspace.xml. 参考博客:https://www.cnbl ...

  7. JavaScript 调试常见报错以及原因

    JavaScript 调试常见报错以及原因 测试环境 chrome 版本 66.0.3359.170(正式版本) (64 位) TypeError 类型错误 不是操作符所接受的数据类型. //---- ...

  8. Django 连接 MySQL 数据库及常见报错解决

    目录 Django 连接 MySQL数据库及常见报错解决 终端或者数据库管理工具连接 MySQL ,并新建项目所需数据库 安装访问 MySQL 的 Python 模块 Django 相关配置 可能会遇 ...

  9. C语言开发中常见报错的解决方案

    C语言开发中常见报错的解决方案 整理来源于网络,侵权请通知删除.*禁止转载 ---- fatal error C1003: error count exceeds number; stopping c ...

随机推荐

  1. Phoenix实现分页查询

    1 利用offset语法,官网的语法 ELECT * FROM TEST LIMIT 1000; SELECT * FROM TEST LIMIT 1000 OFFSET 100; 2 公式如下 SE ...

  2. 快速导入Excel数据到mysql

    首先利用mysql文件,导出csv文件, 然后,直接修改csv文件,然后导入csv文件  

  3. Mysql(三)-3:完整性约束

    一 介绍 约束条件与数据类型的宽度一样,都是可选参数 作用:用于保证数据的完整性和一致性主要分为: PRIMARY KEY (PK) 标识该字段为该表的主键,可以唯一的标识记录 FOREIGN KEY ...

  4. three.js之创建一个几何体

    <html> <head> <title>My first three.js app</title> <style> body { marg ...

  5. YII2组件之GridView

    采用的是yii2.0.14版本,为了学习方便,以问答式书写. 开始GridView GridView主要是为了实现表格复用,尤其我们做后台的时候,你发现表单和表格占据了大部分页面,而表格的样式又是高度 ...

  6. ora-01847:月份中日的值必须介于 1 和当月最后一日之间

    今天解决了一个奇葩问题: ORA-01847: 月份中日的值必须介于 1 和当月最后一日之间 将数据从一个视图倒入到一个同结构的表中,但是老报错,也就那么几个字段,肉眼真看不出来什么问题,但是既然报这 ...

  7. SCU 4584 tarjan+最大权闭合子图

    把每个点的点权当做是W[i]-V[i] 题目一眼是最大权闭合子图 但是可能会有重边自环和环 需要先搞成简单图 再tarjan缩点 缩点后就是裸的最大权闭合子图 #include<bits/std ...

  8. BZOJ 1005 prufer序列

    给出标号为1到N的点,以及某些点最终的度数,允许在任意两点间连线,可产生多少棵度数满足要求的树? 第一行为N(0 < N < = 1000),接下来N行,第i+1行给出第i个节点的度数Di ...

  9. Python main()函数解析

    __main__ — Top-level script environment '__main__'是顶级代码执行的作用域的名字. 当一个模块从标准input, 一个脚本文件,或一个交互命令read读 ...

  10. Django2.1.1与xadmin0.6.0遇到的坑

    Django2.1.1与xadmin0.6.0遇到的坑 BlueMiaomiao关注4人评论11188人阅读2018-09-23 12:17:56 (1)django2.0把from django.c ...