CentOs7重启之后,docker服务无法启动

问题描述

CentOs7断电重启之后,使用systemctl start docker 命令重启docker服务,报错无法启动

1.首先猜测是有docker进程正在运行中,导致的冲突,查询docker相关进程

ps aux | grep docker

结果显示并没有docker的进程

2.根据提示信息查看具体的报错信息

怀疑是/usr/lib/systemd/system/docker.service文件有问题,查看此文件并与网上的进行对比,并没有发现问题,把该文件内容粘贴如下

[Unit]
Description=Docker Application Container Engine
Documentation=https://docs.docker.com
After=network-online.target docker.socket firewalld.service containerd.service time-set.target
Wants=network-online.target containerd.service
Requires=docker.socket

[Service]
Type=notify
# the default is not to use systemd for cgroups because the delegate issues still
# exists and systemd currently does not support the cgroup feature set required
# for containers run by docker
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutStartSec=0
RestartSec=2
Restart=always

# Note that StartLimit* options were moved from "Service" to "Unit" in systemd 229.
# Both the old, and new location are accepted by systemd 229 and up, so using the old location
# to make them work for either version of systemd.
StartLimitBurst=3

# Note that StartLimitInterval was renamed to StartLimitIntervalSec in systemd 230.
# Both the old, and new name are accepted by systemd 230 and up, so using the old name to make
# this option work for either version of systemd.
StartLimitInterval=60s

# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
# Older systemd versions default to a LimitNOFILE of 1024:1024, which is insufficient for many
# applications including dockerd itself and will be inherited. Raise the hard limit, while
# preserving the soft limit for select(2).
LimitNOFILE=1024:524288

# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity

# set delegate yes so that systemd does not reset the cgroups of docker containers
Delegate=yes

# kill only the docker process, not all processes in the cgroup
KillMode=process
OOMScoreAdjust=-500

[Install]
WantedBy=multi-user.target

3.查看docker是否完整无损坏docker version

发现正常

4.查看docker的服务是否存在

systemctl list-unit-files | grep docker

服务正常,未启动的状态

5.最后查看Linux的执行日值

tail -200f /var/log/messages

从日志中发现docker无法创建网桥,与自定义的网桥br0冲突,并且无法自动连接到自定义的网桥br0(自定义网桥参见在虚拟机上安装docker,在防火墙关闭的情况下,虚拟机可以联网,运行的容器内不能联网

解决方法:

将/var/lib/docker/network/files目录下的文件全部删除.

local-kv.db文件记录了docker的网络信息,centos重启可能导致了该文件的损坏,导致网络连接出了问题。

启动docker,发现docker能正常运行

systemctl restart docker

  • 3
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值