Skip to content

Commit d3d4379

Browse files
committed
feat: Improve Docker storage driver test with network error detection
1 parent e083ffc commit d3d4379

1 file changed

Lines changed: 45 additions & 22 deletions

File tree

deployment/setup.sh

Lines changed: 45 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,51 @@ EOF
6464

6565
# Function to test Docker storage driver with an image that has whiteout files
6666
test_docker_storage() {
67-
echo "🧪 Testing Docker storage driver..."
68-
# Use ubuntu:latest which has whiteout files that trigger overlay issues
69-
# hello-world and alpine are too simple
70-
local test_output
71-
if test_output=$(docker pull ubuntu:latest 2>&1); then
72-
# Try to actually run something to ensure extraction worked
73-
if docker run --rm ubuntu:latest echo "Storage driver OK" 2>&1; then
74-
echo "✅ Docker storage driver working"
75-
docker rmi ubuntu:latest >/dev/null 2>&1 || true
76-
return 0
77-
fi
78-
else
79-
# Check if the error is about whiteout files (the specific TFGrid issue)
80-
if echo "$test_output" | grep -q "whiteout"; then
81-
echo "⚠️ Storage driver failed: whiteout file error"
82-
else
83-
echo "⚠️ Storage driver failed: $test_output"
84-
fi
85-
fi
86-
echo "⚠️ Docker storage driver test failed"
87-
docker rmi ubuntu:latest >/dev/null 2>&1 || true
88-
return 1
67+
echo "🧪 Testing Docker storage driver..."
68+
69+
# Use ubuntu:latest which has whiteout files that trigger overlay issues
70+
# hello-world and alpine are too simple
71+
local pull_output
72+
local run_output
73+
74+
# First, try to pull the image
75+
if ! pull_output=$(docker pull ubuntu:latest 2>&1); then
76+
# If we see whiteout/overlay errors, this is a real storage-driver problem
77+
if echo "$pull_output" | grep -qi "whiteout"; then
78+
echo "⚠️ Storage driver failed: whiteout file error"
79+
echo "⚠️ Docker storage driver test failed"
80+
docker rmi ubuntu:latest >/dev/null 2>&1 || true
81+
return 1
82+
fi
83+
84+
# Detect common registry/network connectivity issues and do NOT
85+
# treat them as storage-driver failures. The app will still
86+
# ultimately require registry access for its own images, but
87+
# we don't want to misclassify this as a driver problem.
88+
if echo "$pull_output" | grep -qiE "Client.Timeout|request canceled while waiting for connection|i/o timeout|no such host|temporary failure in name resolution|TLS handshake timeout|connection refused"; then
89+
echo "⚠️ Docker registry unreachable during storage driver test (network issue)"
90+
echo "⚠️ Skipping strict storage-driver validation but continuing with current driver"
91+
return 0
92+
fi
93+
94+
# Unknown pull failure – treat as potential driver issue
95+
echo "⚠️ Storage driver failed: $pull_output"
96+
echo "⚠️ Docker storage driver test failed"
97+
docker rmi ubuntu:latest >/dev/null 2>&1 || true
98+
return 1
99+
fi
100+
101+
# Image pulled successfully; now verify we can run a container
102+
if run_output=$(docker run --rm ubuntu:latest echo "Storage driver OK" 2>&1); then
103+
echo "✅ Docker storage driver working"
104+
docker rmi ubuntu:latest >/dev/null 2>&1 || true
105+
return 0
106+
else
107+
echo "⚠️ Docker run failed during storage driver test: $run_output"
108+
echo "⚠️ Docker storage driver test failed"
109+
docker rmi ubuntu:latest >/dev/null 2>&1 || true
110+
return 1
111+
fi
89112
}
90113

91114
# Install Docker

0 commit comments

Comments
 (0)