Update containers_version.sh

This commit is contained in:
qiaofeng1227 2022-07-18 09:40:31 +08:00 committed by GitHub
parent 57013f5ed8
commit dfca9d126b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,7 +44,18 @@ for appinfo in $(docker ps --format '{{.Names}}%{{.Image}}'); do
break
fi
else
echo "通过服务名匹配"
# 容器和镜像均未匹配成功,通过服务名匹配
realapp=echo $containername|awk -F"-" '{print $1}'
services=docker compose -p $realapp ps --services
for service in $services; do
if [[ $service == $appname ]];then
echo "$containername容器匹配成功app:$appname"
initdata="$initdata $appname"
wget -O /tmp/$appname_get_version.sh https://raw.githubusercontent.com/Websoft9/docker-$appname/main/src/get_version.sh
bash /tmp/$appname_get_version.sh $containername
break
fi
done
fi
done
done