docker启动异常open /var/lib/docker/devicemapper/mnt: no such file or directory

avatar 2023年4月12日18:03:43 评论 1,019 次浏览

docker安装好后,发现启动的时候报错,这里详细分析一下docker启动错误的方法。首先是启动docker,提示错误让你查看启动错误的日志,但是日志内容比较少,又没有详细的错误内容。

[root@www.wulaoer.org ~]# systemctl start docker
Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.
[root@www.wulaoer.org ~]# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: activating (auto-restart) (Result: exit-code) since 一 2023-04-10 21:52:51 CST; 148ms ago
     Docs: https://docs.docker.com
  Process: 2863 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 2863 (code=exited, status=1/FAILURE)

4月 10 21:52:51 swarm systemd[1]: docker.service: main process exited, cod...RE
4月 10 21:52:51 swarm systemd[1]: Failed to start Docker Application Conta...e.
4月 10 21:52:51 swarm systemd[1]: Unit docker.service entered failed state.
4月 10 21:52:51 swarm systemd[1]: docker.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

这里提示docker的错误内容,但是日志内容有时候又无法分析具体原因,我们可以使用dockerd查看日志内容。

[root@www.wulaoer.org ~]# dockerd
INFO[2023-04-10T21:53:26.622495808+08:00] Starting up
INFO[2023-04-10T21:53:26.623525214+08:00] parsed scheme: "unix"                         module=grpc
INFO[2023-04-10T21:53:26.623539026+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2023-04-10T21:53:26.623552492+08:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2023-04-10T21:53:26.623559013+08:00] ClientConn switching balancer to "pick_first"  module=grpc
INFO[2023-04-10T21:53:26.624885845+08:00] parsed scheme: "unix"                         module=grpc
INFO[2023-04-10T21:53:26.624901937+08:00] scheme "unix" not registered, fallback to default scheme  module=grpc
INFO[2023-04-10T21:53:26.624918818+08:00] ccResolverWrapper: sending update to cc: {[{unix:///run/containerd/containerd.sock  <nil> 0 <nil>}] <nil> <nil>}  module=grpc
INFO[2023-04-10T21:53:26.624928173+08:00] ClientConn switching balancer to "pick_first"  module=grpc
WARN[2023-04-10T21:53:26.642196752+08:00] Usage of loopback devices is strongly discouraged for production use. Please use `--storage-opt dm.thinpooldev` or use `man dockerd` to refer to dm.thinpooldev section.  storage-driver=devicemapper
WARN[2023-04-10T21:53:26.675050209+08:00] Base device already exists and has filesystem xfs on it. User specified filesystem  will be ignored.  storage-driver=devicemapper
INFO[2023-04-10T21:53:26.698523768+08:00] [graphdriver] using prior storage driver: devicemapper
WARN[2023-04-10T21:53:26.698553542+08:00] [graphdriver] WARNING: the devicemapper storage-driver is deprecated, and will be removed in a future release
WARN[2023-04-10T21:53:26.701966633+08:00] Unable to find pids cgroup in mounts
INFO[2023-04-10T21:53:26.702299274+08:00] Loading containers: start.
INFO[2023-04-10T21:53:26.820336240+08:00] Default bridge (docker0) is assigned with an IP address 172.17.0.0/16. Daemon option --bip can be used to set a preferred IP address
WARN[2023-04-10T21:53:26.861943570+08:00] unmountAndDeactivate: open /var/lib/docker/devicemapper/mnt: no such file or directory  storage-driver=devicemapper
INFO[2023-04-10T21:53:26.876177650+08:00] stopping event stream following graceful shutdown  error="<nil>" module=libcontainerd namespace=moby
failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Failed to program NAT chain: INVALID_ZONE: docker

提示打不开/var/lib/docker/devicemapper/mnt文件,下面的提示错误是网络异常,我们尝试关闭防火墙试试。然后启动docker

[root@www.wulaoer.org ~]# systemctl stop firewalld.service
[root@www.wulaoer.org ~]# systemctl start docker
[root@www.wulaoer.org ~]# systemctl status docker
● docker.service - Docker Application Container Engine
   Loaded: loaded (/usr/lib/systemd/system/docker.service; enabled; vendor preset: disabled)
   Active: active (running) since 一 2023-04-10 21:55:32 CST; 7min ago
     Docs: https://docs.docker.com
 Main PID: 3106 (dockerd)
   Memory: 36.4M
   CGroup: /system.slice/docker.service
           └─3106 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/cont...

4月 10 21:55:32 swarm dockerd[3106]: time="2023-04-10T21:55:32.225541305+0...r"
4月 10 21:55:32 swarm dockerd[3106]: time="2023-04-10T21:55:32.225567327+0...e"
4月 10 21:55:32 swarm dockerd[3106]: time="2023-04-10T21:55:32.228707890+0...s"
4月 10 21:55:32 swarm dockerd[3106]: time="2023-04-10T21:55:32.228910901+0...."
4月 10 21:55:32 swarm dockerd[3106]: time="2023-04-10T21:55:32.273504137+0...s"
4月 10 21:55:32 swarm dockerd[3106]: time="2023-04-10T21:55:32.326583388+0...."
4月 10 21:55:32 swarm dockerd[3106]: time="2023-04-10T21:55:32.342380348+0....9
4月 10 21:55:32 swarm dockerd[3106]: time="2023-04-10T21:55:32.342478681+0...n"
4月 10 21:55:32 swarm systemd[1]: Started Docker Application Container Engine.
4月 10 21:55:32 swarm dockerd[3106]: time="2023-04-10T21:55:32.360160425+0...k"
Hint: Some lines were ellipsized, use -l to show in full.

关闭防火墙,启动docker,docker正常,

avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: