代码拉取完成,页面将自动刷新
#!/bin/bash
# 创建网络
netName="net-public"
b=`docker network ls | grep ${netName} | awk '{print $2}'`
if [ ${#netName} == ${#b} ]
then
echo "network ${netName} exist"
else
echo "network ${netName} not exist"
docker network create --subnet=172.172.0.0/16 ${netName}
echo "create network ${netName}"
fi
echo "-----------"
#######################
#!/bin/sh
# 工作路径
g_workPath=$(cd `dirname \$0`; pwd -P)
cd $g_workPath
# 创建 network(可以访问外网)
# @param $1 network 名称
mkNetworkPublic(){
netName="$1"
b=`docker network ls | grep ${netName} | awk '{print $2}'`
if [ ${#netName} == ${#b} ]
then
echo "network ${netName} exist"
else
echo "network ${netName} not exist"
docker network create --driver bridge --subnet=172.18.0.0/16 ${netName}
echo "create network ${netName}"
fi
}
# 创建 network(内网)
# @param $1 network 名称
mkNetworkPrivate(){
netName="$1"
b=`docker network ls | grep ${netName} | awk '{print $2}'`
if [ ${#netName} == ${#b} ]
then
echo "network ${netName} exist"
else
echo "network ${netName} not exist"
docker network create --driver bridge --subnet=172.19.0.0/16 --internal ${netName}
echo "create network ${netName}"
fi
}
# 创建网络
echo "----- create network ------"
mkNetworkPublic "net-public"
mkNetworkPrivate "net-private"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。