docker 在ubantu18.0.4上安装遇到的问题failed to start daemon: Error initializing network controller: error obt

文章目录

    • 启动docker时候报错
    • 查看服务状态
    • 查看日志信息
    • 原因
    • 再次开启docker

启动docker时候报错

sudo 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.

查看服务状态

systemctl status docker.service
Dec 20 10:50:53 dell-08 systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Dec 20 10:50:53 dell-08 systemd[1]: docker.service: Scheduled restart job, restart counter is at 3.
Dec 20 10:50:53 dell-08 systemd[1]: Stopped Docker Application Container Engine.
Dec 20 10:50:53 dell-08 systemd[1]: docker.service: Start request repeated too quickly.
Dec 20 10:50:53 dell-08 systemd[1]: docker.service: Failed with result 'exit-code'.
Dec 20 10:50:53 dell-08 systemd[1]: Failed to start Docker Application Container Engine.

查看日志信息

 journalctl -u docker.service
Dec 20 09:47:19 dell-08 systemd[1]: Starting Docker Application Container Engine...
Dec 20 09:47:19 dell-08 dockerd[9897]: time="2023-12-20T09:47:19.785505287+08:00" level=info msg="Starting up"
Dec 20 09:47:19 dell-08 dockerd[9897]: time="2023-12-20T09:47:19.786331056+08:00" level=info msg="detected 127.0.0.53 nameserver, assuming systemd-resolved, so using resolv.conf: /run/systemd/resolve/resolv.conf"
Dec 20 09:47:19 dell-08 dockerd[9897]: time="2023-12-20T09:47:19.883310307+08:00" level=info msg="[graphdriver] using prior storage driver: overlay2"
Dec 20 09:47:19 dell-08 dockerd[9897]: time="2023-12-20T09:47:19.883859748+08:00" level=info msg="Loading containers: start."
Dec 20 09:47:19 dell-08 dockerd[9897]: time="2023-12-20T09:47:19.889121555+08:00" level=warning msg="failed to find iptables" error="exec: \"iptables\": executable file not found in $PATH"
Dec 20 09:47:19 dell-08 dockerd[9897]: time="2023-12-20T09:47:19.890948078+08:00" level=info msg="stopping event stream following graceful shutdown" error="" module=libcontainerd namespace=moby
Dec 20 09:47:19 dell-08 dockerd[9897]: failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: Iptables not found
Dec 20 09:47:19 dell-08 dockerd[9897]: time="2023-12-20T09:47:19.891967113+08:00" level=info msg="stopping event stream following graceful shutdown" error="context canceled" module=libcontainerd namespace=plugins.moby
Dec 20 09:47:19 dell-08 systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Dec 20 09:47:19 dell-08 systemd[1]: docker.service: Failed with result 'exit-code'.
Dec 20 09:47:19 dell-08 systemd[1]: Failed to start Docker Application Container Engine.
Dec 20 09:47:21 dell-08 systemd[1]: docker.service: Service hold-off time over, scheduling restart.

原因

这些错误表明 Docker 无法找到 iptables 命令,它是用于配置网络规则和转发的重要工具。缺少 iptables 可能会导致 Docker 无法初始化网络控制器,从而无法启动。
1.检查 iptables 是否已正确安装在系统上。您可以在终端中运行以下命令来检查:

which iptables

2.如果 iptables 未安装,请根据您使用的操作系统和软件包管理器执行适当的安装命令。例如,对于基于 Debian 的系统(如 Ubuntu),您可以运行以下命令来安装 iptables:

 sudo apt-get update
 sudo apt-get install iptables

3.确保 iptables 被正确配置,并且其可执行文件位于系统的可执行路径中。您可以使用以下命令验证 iptables 的位置:

 echo $PATH

确保输出中包含 /sbin/usr/sbin 目录,这些目录通常包含 iptables 可执行文件。

再次开启docker

sudo systemctl start docker

查看状态

 systemctl status docker.service

the end…

你可能感兴趣的:(docker,java)