启动了docker容器,网卡较多。 只需要获取hostname对应的ip:
local_host="`hostname --fqdn`" ServiceIP=`nslookup -sil $local_host 2>/dev/null | grep Address: | sed '1d' | sed 's/Address://g'` echo ${ServiceIP}