This commit is contained in:
qiaofeng1227 2024-03-14 14:44:25 +08:00
parent 76534fac30
commit 611142260a
2 changed files with 5 additions and 21 deletions

View file

@ -21,26 +21,10 @@ check_ports() {
# get volume from container # get volume from container
function get_volume_path() { function get_volume_path() {
local container_name="\$1" local container_name="$1"
local volume_name="\$2" local volume_name="$2"
local retries=0 local mounts=$(docker inspect -f '{{ json .Mounts }}' "$container_name" | jq -r '.[] | select(.Name == "'$volume_name'") | .Source')
local max_retries=5 echo "$mounts"
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") volume_path=$(get_volume_path "$container_name" "$volume_name")

View file

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