网络类型介绍:https://blog.csdn.net/ithaibiantingsong/article/details/81386307?utm_source=app&app_version=4.5.2
查看网络:https://blog.csdn.net/weixin_43733154/article/details/110119533?utm_source=app&app_version=4.5.2
常用命令:ip转发深入研究文章 https://blog.csdn.net/li_101357/article/details/78415461
docker network ls #
brctl show
cat /proc/sys/net/ipv4/ip_forward # 默认是0 echo给上1 就可以转发
# 永久修改 参考文章:https://www.cnblogs.com/wangbaobao/p/6674464.html
echo "echo 1 > /proc/sys/net/ipv4/ip_forward" >> /etc/rc.d/rc.local \
&& echo 1 > /proc/sys/net/ipv4/ip_forward \
&& chmod +x /etc/rc.d/rc.local \
&& ll /etc/rc.d/rc.local \
&& cat /proc/sys/net/ipv4/ip_forward
# 网络查看脚本
#!/bin/bash
#
## Define variables
Result="./all_container_net_type.txt"
## Empty or new $Result file
>$Result
## For loop
All_stat_container_id=( $(docker container ls -aq) )
for((i=0;i<${#All_stat_container_id[*]};i++))
do
# define variables
Container_type_info=" $(docker container inspect ${All_stat_container_id[i]} | grep "NetworkMode"|grep -w "$Container_net_type" |sed 's# ##g') "
# Save the result
echo "${All_stat_container_id[i]} $Container_type_info" >>$Result
done
## Rusult info
echo "Result to \"$Result\" file"