mirror of
https://github.com/juliengk/csf-post-docker.git
synced 2023-10-10 13:37:41 +02:00
Add verification of NetworkMode setting when getting IP address value
This commit is contained in:
parent
7c303d7c3c
commit
e78db14fbf
@ -38,7 +38,13 @@ if [ `echo ${containers} | wc -c` -gt "1" ] ; then
|
||||
rules=`docker port ${container} | sed 's/ //g'`
|
||||
|
||||
if [ `echo ${rules} | wc -c` -gt "1" ] ; then
|
||||
ipaddr=`docker inspect -f "{{.NetworkSettings.IPAddress}}" ${container}`
|
||||
netmode=`docker inspect -f "{{.HostConfig.NetworkMode}}" ${container}`
|
||||
|
||||
if [ $netmode == "default" ]; then
|
||||
ipaddr=`docker inspect -f "{{.NetworkSettings.IPAddress}}" ${container}`
|
||||
else
|
||||
ipaddr=`docker inspect -f "{{.NetworkSettings.Networks.${netmode}.IPAddress}}" ${container}`
|
||||
fi
|
||||
|
||||
for rule in ${rules} ; do
|
||||
src=`echo ${rule} | awk -F'->' '{ print $2 }'`
|
||||
|
Loading…
Reference in New Issue
Block a user