ARM64安裝Docker的問題以及對應的內核配置項


通過 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

【錯誤】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就好

參考 https://docs.docker.com/engine/reference/commandline/dockerd/

配置 /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
 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM