This commit is contained in:
qiaofeng1227 2024-03-14 14:14:10 +08:00
parent 38ad90bd30
commit 76534fac30
2 changed files with 21 additions and 5 deletions

View file

@ -21,10 +21,26 @@ check_ports() {
# get volume from container
function get_volume_path() {
local container_name="$1"
local volume_name="$2"
local mounts=$(docker inspect -f '{{ json .Mounts }}' "$container_name" | jq -r '.[] | select(.Name == "'$volume_name'") | .Source')
echo "$mounts"
local container_name="\$1"
local volume_name="\$2"
local retries=0
local max_retries=5
local mounts
while [ $retries -lt $max_retries ]; do
mounts=$(docker inspect -f '{{ json .Mounts }}' "$container_name" | jq -r ".[] | select(.Name == \"$volume_name\") | .Source")
if [[ "$mounts" == *"/"* ]]; then
echo "$mounts"
return 0
fi
((retries++))
sleep 5
done
echo "Cannot get volume path"
exit 1
}
volume_path=$(get_volume_path "$container_name" "$volume_name")

View file

@ -1,5 +1,5 @@
{
"version": "2.0.3",
"version": "2.0.4",
"plugins": {
"portainer": "0.0.9",
"nginx": "0.0.7",