玩客云-32位armbian-安装(启动)-docker-报错

Job for docker.service failed because the control process exited with error code.
See "systemctl status docker.service" and "journalctl -xe" for details.
invoke-rc.d: initscript docker, action "start" failed.
* docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
   Active: activating (auto-restart) (Result: exit-code) since Fri 2021-10-22 15:56:54 UTC; 61ms ago
     Docs: https://docs.docker.com
  Process: 10964 ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock (code=exited, status=1/FAILURE)
 Main PID: 10964 (code=exited, status=1/FAILURE)
dpkg: error processing package docker-ce (--configure):
 installed docker-ce package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
 docker-ce
E: Sub-process /usr/bin/dpkg returned an error code (1)

通过 dockerd --debug查看到错误

DEBU[2021-10-22T15:58:30.350402277Z] Cleaning up old mountid : done.              
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: iptables/1.8.2 Failed to initialize nft: Protocol not supported
 (exit status 1)

原因应该是 iptables/1.8.2 Failed to initialize nft: Protocol not supported

然后找到这个解决办法(https://superuser.com/questions/1480986/iptables-1-8-2-failed-to-initialize-nft-protocol-not-supported),大概说现在的内核不支持新的iptables,按照他的方法使用以前的iptables

# 改回来的方法就是把最后的legacy改成
update-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
update-alternatives --set arptables /usr/sbin/arptables-legacy
update-alternatives --set ebtables /usr/sbin/ebtables-legacy

依然报错,再次debug看到

DEBU[2021-10-22T16:14:16.130962872Z] Cleaning up old mountid : done.              
failed to start daemon: Error initializing network controller: error obtaining controller instance: failed to create NAT chain DOCKER: iptables failed: iptables -t nat -N DOCKER: modprobe: ERROR: ../libkmod/libkmod.c:586 kmod_search_moddep() could not open moddep file '/lib/modules/5.3.8-aml-OC-BonusCloud/modules.dep.bin'
modprobe: FATAL: Module ip_tables not found in directory /lib/modules/5.3.8-aml-OC-BonusCloud
iptables v1.8.2 (legacy): can't initialize iptables table `nat': Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.
 (exit status 3)