Docker启动时的报错汇总

简介: 报错一:error initializing graphdriverDocker启动报错系统是CentOS 7.2系统内核及docker版本如下 :[root@docker ~]# uname -r3.

报错一: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
相关文章
|
24天前
|
安全 Docker 容器
Docker中运行容器时Operation not permitted报错问题解决
【10月更文挑战第2天】Docker中运行容器时Operation not permitted报错问题解决
168 3
|
28天前
|
搜索推荐 应用服务中间件 nginx
docker与containerd镜像获取及导出导入的区别与注意事项(报错信息:ctr: content digest sha256........ac47: not found)
docker与containerd镜像获取及导出导入的区别与注意事项(报错信息:ctr: content digest sha256........ac47: not found)
|
13天前
|
JavaScript 前端开发 Docker
拿下奇怪的前端报错(二):nvm不可用报错`GLIBC_2.27‘‘GLIBCXX_3.4.20‘not Found?+ 使用docker构建多个前端项目实践
本文介绍了在多版本Node.js环境中使用nvm进行版本管理和遇到的问题,以及通过Docker化构建流程来解决兼容性问题的方法。文中详细描述了构建Docker镜像、启动临时容器复制构建产物的具体步骤,有效解决了不同项目对Node.js版本的不同需求。
|
13天前
|
网络虚拟化 Docker 容器
docker Desktop报错 error pulling image configuration 处理
docker Desktop报错 error pulling image configuration 处理
27 0
|
28天前
|
网络协议 应用服务中间件 Linux
docker常见报错提示WARNING: IPv4 forwarding is disabled. Networking will not work.或/usr/bin/docker-current:
### 故障与解决方法概览 1. **故障现象**:运行 `docker run -d -P httpd:centos` 时提示“IPv4转发已禁用,网络将无法工作”。 - **解决方法**:通过编辑 `/etc/sysctl.conf` 设置 `net.ipv4.ip_forward=1` 并执行 `sysctl -p` 启用路由转发,然后重启 Docker 服务。
|
2月前
|
Shell 数据安全/隐私保护 Docker
9-2|docker rm报错
9-2|docker rm报错
|
2月前
|
Unix Shell Linux
5-15|Docker报错OCI runtime exec failed: exec failed: unable to start container process: exec: “/bin/ba
5-15|Docker报错OCI runtime exec failed: exec failed: unable to start container process: exec: “/bin/ba
|
2月前
|
关系型数据库 MySQL 数据库
docker启动mysql多实例连接报错Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
docker启动mysql多实例连接报错Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’
150 0
|
3月前
|
运维 Java Devops
阿里云云效操作报错合集之部署docker时遇到报错,该怎么办
本合集将整理呈现用户在使用过程中遇到的报错及其对应的解决办法,包括但不限于账户权限设置错误、项目配置不正确、代码提交冲突、构建任务执行失败、测试环境异常、需求流转阻塞等问题。阿里云云效是一站式企业级研发协同和DevOps平台,为企业提供从需求规划、开发、测试、发布到运维、运营的全流程端到端服务和工具支撑,致力于提升企业的研发效能和创新能力。
|
3月前
|
Docker 容器
【Azure 应用服务】App Server 部署后,Docker报错,找不到8080端口
【Azure 应用服务】App Server 部署后,Docker报错,找不到8080端口