通过 service start docker 或 systemctl start docker 或 dockerd 的问题
背景介绍:Arm Linux开发板,内核有经过裁剪的情况下,以下操作均指内核menuconfig配置项目
错误通过提示或在控制台界面journalctl-xe获得
【错误】[graphdriver] prior storage driver overlay2 failed: driver not supported
==> CONFIG_OVERLAY_FS=y
【错误】iptables v1.6.1: can't initialize iptables table `nat': Table does not exist
==> 开启IPV4的NAT及其必要前置,IP_NF_NAT
CONFIG_NF_CONNTRACK=y
CONFIG_NF_CONNTRACK_IPV4=y
CONFIG_NF_NAT_IPV4=y
CONFIG_NF_NAT_MASQUERADE_IPV4=y
CONFIG_IP_NF_IPTABLES=y
CONFIG_NF_TABLES=y
CONFIG_IP_NF_NAT=y
Networking support > Networking options > Network packet filtering framework (Netfilter) > IP: Netfilter Configuration >IP tables support => y
做成模块的,可能无法自动加载而导致失败
【错误】 DOCKER: iptables v1.6.1: can't initialize iptables table `filter': Table does not exist
==> 开启Packet filtering及其必要前置
CONFIG_NF_TABLES_IPV4=y
CONFIG_NFT_CHAIN_NAT_IPV4=y
CONFIG_IP_NF_FILTER=y
【错误】Error initializing network controller: Error creating default "bridge" network: package not installed
==> 开启 Ethernet Bridge tables (ebtables) support 及其必要前置
CONFIG_BRIDGE
NF_TABLES_BRIDGE
CONFIG_BRIDGE_NF_EBTABLES
【错误】iptables failed: iptables --wait -t nat -I POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE: iptables: No chain/target/match by that name.
==>开启 MASQUERADE target support ,开启Masquerade 链
CONFIG_IP_NF_TARGET_MASQUERADE ---->这个要打开IP virtual server support,然后进入IP: Netfilter Configuration 配置
【错误】Failed to inject DOCKER in PREROUTING chain: iptables failed: iptables --wait -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER: iptables: No chain/target/match by that name.
==> addrtype的目标匹配不支持,打开即可
--wait : maximum wait to acquire xtables lock before give up:获取xtables锁的最大等待数)
-t : --table : table to manipulate (default: `filter') :要维护的表
-A:--append: Append to chain:附加到表
-m:--match:extended match (may load extension):扩展匹配(或加载扩展)目标
这里是 address类型的match没有找到
CONFIG_NFT_CHAIN_ROUTE_IPV4
CONFIG_NFT_NAT
CONFIG_NFT_REDIR
CONFIG_NETFILTER_XT_MATCH_ADDRTYPE
【错误】 iptables failed: iptables --wait -I FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT: iptables: No chain/target/match by that name.
==>conntrack 目标匹配没有支持,打开就好
-I:--insert:Insert in chain as rulenum (default 1=first):插入到链
-j:--jump:jump to chain with no return:跳转到链
CONFIG_NETFILTER_XT_MATCH_CONNTRACK
=============================其他未仔细验证=============================
【错误2】
failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Failed to Setup IP tables: Unable to enable NAT rule: (iptables failed: iptables --wait -t nat -I POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE: iptables: No chain/target/match by that name.
【解决2】
CONFIG_BRIDGE_NETFILTER=y,以及其他带bridge字眼的选项(可能也要试试解决3)
【错误3】
failed to start daemon: Error initializing network controller: Error creating default "bridge" network: Failed to program NAT chain: Failed to inject DOCKER in PREROUTING chain: iptables failed: iptables --wait -t nat -A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER: iptables: No chain/target/match by that name.
【解决3】
Networking support > Networking options > Network packet filtering framework (Netfilter)
把这下面所有的项目都勾上(包括各子项)
【错误4】
failed to mount overlay: no such device storage-driver=overlay
【解决4】
选择可用的storage-driver就好
配置 /etc/docker/daemon.json
1 {
2 "storage-driver": "overlay" (或overlay2)
3 }
=================================警告的消除=================================
CONFIG_RT_GROUP_SCHED= y 消除 "CPU realtime scheduler"
CONFIG_BLK_DEV_THROTTLING = y 消除 "blk:throttling xxx"
CONFIG_CFQ_GROUP_IOSCHED = y 消除 "cgroup:xxx"
==============================运行时报错===================================
【错误】Error response from daemon: failed to create endpoint affectionate_cannon on network bridge: failed to add the host (veth0d6948a) <=> sandbox (vethde4d54f) pair interfaces: operation not supported.
==> VETH=y
【错误】rootfs_linux.go:76: mounting "mqueue" to rootfs at "/dev/mqueue" caused: mount through procfd: no such device: unknown.
==>POSIX_MQUEUE=y
【错误】 CONFIG_CGROUP_BPF: missing---->解决办法
1 CONFIG_CGROUP_BPF=y
2 CONFIG_BPF=y
3 CONFIG_BPF_SYSCALL=y
4 CONFIG_NETFILTER_XT_MATCH_BPF=y
5 CONFIG_INET_UDP_DIAG=y
这些都是相关联的
【错误】要打开 CONFIG_BRIDGE_VLAN_FILTERING---->必须先打开
CONFIG_VLAN_8021Q=y
【错误】 - CONFIG_AUFS_FS: missing
aufs安装完后,就可以打开。
原作者:DMCF