docker 报错,有大佬知道怎么解决吗

2023-02-25 14:46:20 +08:00
 wolfcdd
[root@localhost]# 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.
[root@localhost]# sudo docker version
Client: Docker Engine - Community
Version: 23.0.1
API version: 1.42
Go version: go1.19.5
Git commit: a5ee5b1
Built: Thu Feb 9 19:51:00 2023
OS/Arch: linux/amd64
Context: default
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost]# journalctl -xe
2 月 25 14:42:50 localhost.localdomain dockerd[9522]: time="2023-02-25T14:42:50.664081529+08:00" level=info msg="[core] [Channel #1] Channel Connectivity change to SHUTDOWN" module=grpc
2 月 25 14:42:50 localhost.localdomain dockerd[9522]: time="2023-02-25T14:42:50.664111211+08:00" level=info msg="[core] [Channel #1 SubChannel #2] Subchannel Connectivity change to SHUTDOWN" module=grpc
2 月 25 14:42:50 localhost.localdomain dockerd[9522]: time="2023-02-25T14:42:50.664122609+08:00" level=info msg="[core] [Channel #1 SubChannel #2] Subchannel deleted" module=grpc
2 月 25 14:42:50 localhost.localdomain dockerd[9522]: time="2023-02-25T14:42:50.664128892+08:00" level=info msg="[core] [Channel #1] Channel deleted" module=grpc
2 月 25 14:42:50 localhost.localdomain dockerd[9522]: time="2023-02-25T14:42:50.664210497+08:00" level=info msg="stopping event stream following graceful shutdown" error="<nil>" module=libcontainerd namespace=moby
2 月 25 14:42:50 localhost.localdomain dockerd[9522]: failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t nat -N
2 月 25 14:42:50 localhost.localdomain dockerd[9522]: Perhaps iptables or your kernel needs to be upgraded.
2 月 25 14:42:50 localhost.localdomain systemd[1]: docker.service: main process exited, code=exited, status=1/FAILURE
2 月 25 14:42:50 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
2 月 25 14:42:50 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
2 月 25 14:42:50 localhost.localdomain systemd[1]: docker.service failed.
2 月 25 14:42:52 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
2 月 25 14:42:52 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
-- Subject: Unit docker.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has finished shutting down.
2 月 25 14:42:52 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
2 月 25 14:42:52 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
2 月 25 14:42:52 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
2 月 25 14:42:52 localhost.localdomain systemd[1]: docker.service failed.
2 月 25 14:42:53 localhost.localdomain sudo[9612]: root : TTY=pts/0 ; PWD=/home/ ; USER=root ; COMMAND=/bin/docker version
2 月 25 14:42:53 localhost.localdomain sudo[9612]: pam_unix(sudo:session): session opened for user root(uid=0)
2 月 25 14:42:53 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
2 月 25 14:42:53 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit docker.service has failed.
--
-- The result is failed.
2 月 25 14:42:53 localhost.localdomain systemd[1]: Unit docker.socket entered failed state.
2 月 25 14:42:53 localhost.localdomain systemd[1]: docker.service failed.
2 月 25 14:42:53 localhost.localdomain sudo[9612]: pam_unix(sudo:session): session closed for user root
1164 次点击
所在节点    Docker
7 条回复
ashong
2023-02-25 14:50:05 +08:00
2 月 25 14:42:50 localhost.localdomain dockerd[9522]: failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: COMMAND_FAILED: '/usr/sbin/iptables -w10 -t nat -N

指出问题出在 iptables
wolfcdd
2023-02-25 15:12:58 +08:00
@ashong 通过重装 iptables 也没解决,然后 iptables 也报错了。。。。
[root@localhost]# sudo systemctl start iptables
Failed to start iptables.service: Unit not found.

remove 掉 iptables 的时候提示删了 400 多 M ,然后重装 iptables 的时候只需要 1.5M ;这个系统是不是没得救了。。。


移除 1 软件包 (+91 依赖软件包)

安装大小:244 M
是否继续?[y/N]:y

安装 1 软件包

总下载量:432 k
安装大小:1.5 M
Is this ok [y/d/N]: y
wolfcdd
2023-02-25 15:15:25 +08:00
@wolfcdd 删了 200 多 M ,重新安装只安装了 1.5.。。。我是不是要重装系统了。。。
ashong
2023-02-25 15:18:31 +08:00
卸载 iptables 后 autoremove

然后再重装试试
wolfcdd
2023-02-25 15:29:29 +08:00
@ashong

[root@localhost ~]# yum autoremove iptables
Loaded plugins: fastestmirror, langpacks
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-ct to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe packag
--> Running transaction check
---> Package iptables.x86_64 0:1.4.21-35.el7 will be erased
--> Finished Dependency Resolution
--> Finding unneeded leftover dependencies
---> Marking libnfnetlink to be removed - no longer needed by iptables
---> Marking libnetfilter_conntrack to be removed - no longer needed by iptables
Found and removing 2 unneeded dependencies
--> Running transaction check
---> Package libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3 will be erased
---> Package libnfnetlink.x86_64 0:1.0.1-4.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================
Package Arch Version
========================================================================
Removing:
iptables x86_64 1.4.21-35.el7
Removing for dependencies:
libnetfilter_conntrack x86_64 1.0.6-1.el7_3
libnfnetlink x86_64 1.0.1-4.el7

Transaction Summary
========================================================================
Remove 1 Package (+2 Dependent packages)

Installed size: 1.7 M
Is this ok [y/N]: y
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Erasing : iptables-1.4.21-35.el7.x86_64 1/3
Erasing : libnetfilter_conntrack-1.0.6-1.el7_3.x86_64 2/3
Erasing : libnfnetlink-1.0.1-4.el7.x86_64 3/3
Verifying : libnfnetlink-1.0.1-4.el7.x86_64 1/3
Verifying : libnetfilter_conntrack-1.0.6-1.el7_3.x86_64 2/3
Verifying : iptables-1.4.21-35.el7.x86_64 3/3

Removed:
iptables.x86_64 0:1.4.21-35.el7

Dependency Removed:
libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3 libnfnetlink.x86_64 0:1.0.1-4.el7

Complete!
[root@localhost ~]# yum install iptables
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.ustc.edu.cn
* epel: hkg.mirror.rackspace.com
* extras: mirrors.163.com
* updates: mirrors.ustc.edu.cn
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
--> Running transaction check
---> Package iptables.x86_64 0:1.4.21-35.el7 will be installed
--> Processing Dependency: libnfnetlink.so.0()(64bit) for package: iptables-1.4.21-35.el7.x86_64
--> Processing Dependency: libnetfilter_conntrack.so.3()(64bit) for package: iptables-1.4.21-35.el7.x86_64
--> Running transaction check
---> Package libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3 will be installed
---> Package libnfnetlink.x86_64 0:1.0.1-4.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================
Package Arch Version Repository Size
========================================================================
Installing:
iptables x86_64 1.4.21-35.el7 base 432 k
Installing for dependencies:
libnetfilter_conntrack x86_64 1.0.6-1.el7_3 base 55 k
libnfnetlink x86_64 1.0.1-4.el7 base 26 k

Transaction Summary
========================================================================
Install 1 Package (+2 Dependent packages)

Total download size: 514 k
Installed size: 1.7 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): libnetfilter_conntrack-1.0.6-1.el7_3.x86_64.rpm | 55 kB 00:00:00
(2/3): iptables-1.4.21-35.el7.x86_64.rpm | 432 kB 00:00:00
(3/3): libnfnetlink-1.0.1-4.el7.x86_64.rpm | 26 kB 00:00:00
----------------------------------------------------------------------------------------------------------
Total 2.2 MB/s | 514 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : libnfnetlink-1.0.1-4.el7.x86_64 1/3
Installing : libnetfilter_conntrack-1.0.6-1.el7_3.x86_64 2/3
Installing : iptables-1.4.21-35.el7.x86_64 3/3
Verifying : libnfnetlink-1.0.1-4.el7.x86_64 1/3
Verifying : libnetfilter_conntrack-1.0.6-1.el7_3.x86_64 2/3
Verifying : iptables-1.4.21-35.el7.x86_64 3/3

Installed:
iptables.x86_64 0:1.4.21-35.el7

Dependency Installed:
libnetfilter_conntrack.x86_64 0:1.0.6-1.el7_3 libnfnetlink.x86_64 0:1.0.1-4.el7

Complete!

[root@localhost ~]# docker ps
Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
[root@localhost ~]# systemctl status docker
● docker.service
Loaded: not-found (Reason: No such file or directory)
Active: failed (Result: start-limit) since Sat 2023-02-25 14:42:52 CST; 40min ago
Main PID: 9522 (code=exited, status=1/FAILURE)

Feb 25 14:42:50 localhost.localdomain systemd[1]: docker.service failed.
Feb 25 14:42:52 localhost.localdomain systemd[1]: docker.service holdoff time over, scheduling restart.
Feb 25 14:42:52 localhost.localdomain systemd[1]: Stopped Docker Application Container Engine.
Feb 25 14:42:52 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
Feb 25 14:42:52 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Feb 25 14:42:52 localhost.localdomain systemd[1]: Unit docker.service entered failed state.
Feb 25 14:42:52 localhost.localdomain systemd[1]: docker.service failed.
Feb 25 14:42:53 localhost.localdomain systemd[1]: start request repeated too quickly for docker.service
Feb 25 14:42:53 localhost.localdomain systemd[1]: Failed to start Docker Application Container Engine.
Feb 25 14:42:53 localhost.localdomain systemd[1]: docker.service failed.
[root@localhost ~]# journalctl -xe
-- Subject: Unit fprintd.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fprintd.service has begun starting up.
Feb 25 15:21:56 localhost.localdomain dbus[872]: [system] Successfully activated service 'net.reactivated.
Feb 25 15:21:56 localhost.localdomain systemd[1]: Started Fingerprint Authentication Daemon.
-- Subject: Unit fprintd.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit fprintd.service has finished starting up.
--
-- The start-up result is done.
Feb 25 15:21:56 localhost.localdomain gnome-shell[2748]: clutter_actor_get_n_children: assertion 'CLUTTER_
Feb 25 15:22:18 localhost.localdomain sshd[13615]: Accepted password for root from 10.0.0.110 port 53194 s
Feb 25 15:22:18 localhost.localdomain systemd[1]: Started Session 322 of user root.
-- Subject: Unit session-322.scope has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit session-322.scope has finished starting up.
--
-- The leading process of the session is 13615.
Feb 25 15:22:18 localhost.localdomain sshd[13615]: pam_unix(sshd:session): session opened for user root by
Feb 25 15:22:59 localhost.localdomain yum[13659]: Erased: iptables-1.4.21-35.el7.x86_64
Feb 25 15:22:59 localhost.localdomain yum[13659]: Erased: libnetfilter_conntrack-1.0.6-1.el7_3.x86_64
Feb 25 15:22:59 localhost.localdomain yum[13659]: Erased: libnfnetlink-1.0.1-4.el7.x86_64
Feb 25 15:23:17 localhost.localdomain yum[13683]: Installed: libnfnetlink-1.0.1-4.el7.x86_64
Feb 25 15:23:17 localhost.localdomain yum[13683]: Installed: libnetfilter_conntrack-1.0.6-1.el7_3.x86_64
Feb 25 15:23:17 localhost.localdomain yum[13683]: Installed: iptables-1.4.21-35.el7.x86_64

[root@localhost ~]# systemctl status iptables
Unit iptables.service could not be found.
[root@localhost ~]# systemctl start iptables
Failed to start iptables.service: Unit not found.

一样的错误。。。。
yianing
2023-02-25 19:06:24 +08:00
iptables 是一个工具,不是服务,用来操作 netfilter 的
Nnq
2023-02-26 05:12:07 +08:00
yum install iptables-services

这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。

https://www.v2ex.com/t/919120

V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。

V2EX is a community of developers, designers and creative people.

© 2021 V2EX