今天公司服务器意外重启了。重启以后同事发现docker 无法使用。

OS: centOS 7

docker version:
Client:
 Version:      18.03.1-ce
 API version:  1.37
 Go version:   go1.9.2
 Git commit:   9ee9f40
 Built:        Thu Apr 26 07:12:25 2018
 OS/Arch:      linux/amd64
 Experimental: false
 Orchestrator: swarm

Server:
 Engine:
  Version:      18.03.1-ce
  API version:  1.37 (minimum version 1.12)
  Go version:   go1.9.5
  Git commit:   9ee9f40
  Built:        Thu Apr 26 07:23:03 2018
  OS/Arch:      linux/amd64
  Experimental: false


问题描述:

docker engine

没有任何响应, 无论是docker ps还是docker version,都没有任何响应,也不报错

sudo systemctl status docker

显示

* docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
  Drop-In: /etc/systemd/system/docker.service.d
           `-http-proxy.conf
   Active: activating (start) since Thu 2019-02-14 08:34:58 CET; 37s ago
     Docs: https://docs.docker.com
 Main PID: 8475 (dockerd)
   Memory: 13.1M
   CGroup: /system.slice/docker.service
           |-8475 /usr/bin/dockerd
           `-8484 docker-containerd --config /var/run/docker/containerd/containerd.toml

Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58+01:00" level=info msg="loading plugin "io.containerd.monitor.v1.cgroups"..." module=containerd type=io.containerd.monitor.v1
Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58+01:00" level=info msg="loading plugin "io.containerd.runtime.v1.linux"..." module=containerd type=io.containerd.runtime.v1
Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58+01:00" level=info msg="loading plugin "io.containerd.grpc.v1.tasks"..." module=containerd type=io.containerd.grpc.v1
Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58+01:00" level=info msg="loading plugin "io.containerd.grpc.v1.version"..." module=containerd type=io.containerd.grpc.v1
Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58+01:00" level=info msg="loading plugin "io.containerd.grpc.v1.introspection"..." module=containerd type=io.containerd.grpc.v1
Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58+01:00" level=info msg=serving... address="/var/run/docker/containerd/docker-containerd-debug.sock" module="containerd/debug"
Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58+01:00" level=info msg=serving... address="/var/run/docker/containerd/docker-containerd.sock" module="containerd/grpc"
Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58+01:00" level=info msg="containerd successfully booted in 0.003594s" module=containerd
Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58.182112149+01:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Feb 14 08:34:58 seroius00607 dockerd[8475]: time="2019-02-14T08:34:58.182840376+01:00" level=info msg="Loading containers: start."

依然没有错误。

最后发现是因为服务器重启后 firewall比docker先启动,从而影响了docker对iptable的操作。所以docker engine就卡住了。

解决办法

1.关闭firewalld

sudo systemctl stop firewalld

2. 启动docker

sudo systemctl restart docker

3.启动firewalld

sudo systemctl restart firewalld

搞定

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐