@@ -264,11 +264,11 @@ runAgent(){
264
264
then
265
265
if [ ! " $( docker ps -a -f " name=$AI " --format ' {{.Names}}' ) " ]
266
266
then
267
- echo " INFO: Starting new container"
267
+ echo " INFO: Starting new container using network mode $NETWORK "
268
268
if [ -f " $CONFDIR " /config.properties ]; then
269
- docker run -d --env-file " $CONFDIR " /config.properties -v " $PV " :/app --group-add " $groupId " --name " $AI " " $imageName "
269
+ docker run -d --network " $NETWORK " -- env-file " $CONFDIR " /config.properties -v " $PV " :/app --group-add " $groupId " --name " $AI " " $imageName "
270
270
else
271
- docker run -d -v " $PV " :/app --group-add " $groupId " --name " $AI " " $imageName "
271
+ docker run -d --network " $NETWORK " - v " $PV " :/app --group-add " $groupId " --name " $AI " " $imageName "
272
272
fi
273
273
docker exec " $AI " /bin/bash -c ' agent ido validate --config /app/data/conf/config.json; if [[ "$?" != "0" ]] ; then echo VALIDATE_FAILED > /app/data/conf/status.txt; else echo VALIDATE_SUCCESS > /app/data/conf/status.txt; fi ;'
274
274
validateStatus=$( cat " $CONFDIR " /status.txt)
@@ -312,11 +312,11 @@ runAgent(){
312
312
then
313
313
if [ ! " $( podman ps -a -f " name=$AI " --format ' {{.Names}}' ) " ]
314
314
then
315
- echo " INFO: Starting new container"
315
+ echo " INFO: Starting new container using network mode $NETWORK "
316
316
if [ -f " $CONFDIR " /config.properties ]; then
317
- podman run -d --env-file " $CONFDIR " /config.properties -v " $PV " :/app --group-add " $groupId " --name " $AI " " $imageName "
317
+ podman run -d --network " $NETWORK " -- env-file " $CONFDIR " /config.properties -v " $PV " :/app --group-add " $groupId " --name " $AI " " $imageName "
318
318
else
319
- podman run -d -v " $PV " :/app --group-add " $groupId " --name " $AI " " $imageName "
319
+ podman run -d --network " $NETWORK " - v " $PV " :/app --group-add " $groupId " --name " $AI " " $imageName "
320
320
fi
321
321
322
322
podman exec " $AI " /bin/bash -c ' agent ido validate --config /app/data/conf/config.json; if [[ "$?" != "0" ]] ; then echo VALIDATE_FAILED > /app/data/conf/status.txt; else echo VALIDATE_SUCCESS > /app/data/conf/status.txt; fi ;'
@@ -692,6 +692,10 @@ start()
692
692
if [ -f " $configOverride " ]; then
693
693
kill
694
694
fi
695
+ if [ " $NETWORK " = " " ];
696
+ then
697
+ NETWORK=" host"
698
+ fi
695
699
runAgent
696
700
echo " "
697
701
agentVersion=$( grep agentVersion " $CONFDIR " /config.json | awk ' { print $2 }' | sed ' s/,//g' )
@@ -1030,6 +1034,8 @@ Help()
1030
1034
echo " -ap|--agentpackage No(Required in validate,install
1031
1035
and upgrade) \"\" Agent Package Path"
1032
1036
echo " -c|--config No - Path of the custom config property file"
1037
+ echo " -n|--network No host Configuration to change the network type
1038
+ of the container runtime."
1033
1039
echo " -pv|--volume Yes - Directory to persist agent data such as
1034
1040
configuration, wallet, logs, etc."
1035
1041
@@ -1095,6 +1101,7 @@ while [ $# -gt 0 ]; do
1095
1101
" -pv" |" --volume" ) createDir " $1 " ; echo PV=" $( cd " $( dirname " $1 " ) " || exit 1; pwd -P) " /" $( basename " $1 " ) " >> " $ENV_FILE_TEMP " ; shift ;;
1096
1102
" -h" |" --help" ) Help; exit 1;;
1097
1103
" -ai" |" --agentid" ) echo AI=" $1 " >> " $ENV_FILE_TEMP " ; shift ;;
1104
+ " -n" |" --network" ) echo NETWORK=" $1 " >> " $ENV_FILE_TEMP " ; shift ;;
1098
1105
" -au" |" --autoupgrade" ) echo AU=" $1 " >> " $ENV_FILE_TEMP " ; shift ;;
1099
1106
" -ap" |" --agentpackage" ) echo AP=" $( cd " $( dirname " $1 " ) " || exit 1; pwd -P) " /" $( basename " $1 " ) " >> " $ENV_FILE_TEMP " ; shift ;;
1100
1107
" -c" |" --config" ) configOverride=$( cd " $( dirname " $1 " ) " || exit 1; pwd -P) /$( basename " $1 " ) ; shift ;;
0 commit comments