File tree Expand file tree Collapse file tree 1 file changed +45
-1
lines changed Expand file tree Collapse file tree 1 file changed +45
-1
lines changed Original file line number Diff line number Diff line change 1- services :
1+ services :
22 configurator :
33 environment :
44 PROJECT_CLONE_URL : https://github.com/dockersamples/labspace-fine-tuning
5+ SETUP_SCRIPT : /scripts/validate-environment.sh
6+ volumes :
7+ - /var/run/docker.sock:/var/run/docker.sock
8+ configs :
9+ - source : validation-script
10+ target : /scripts/validate-environment.sh
511
612 workspace :
713 environment :
814 MODEL_RUNNER_HOST : http://172.17.0.1:12435
15+
16+ configs :
17+ validation-script :
18+ content : |
19+ #!/bin/bash
20+
21+ set -e
22+
23+ # Get Docker info as JSON. The `docker` CLI isn't available, so directly querying
24+ DOCKER_INFO=$(curl -fq --unix-socket /var/run/docker.sock http://localhost/info)
25+
26+ # Check if running in Docker Offload environment
27+ echo "🔎 Checking Docker Offload environment..."
28+ OFFLOAD_LABEL=$(echo "$$DOCKER_INFO" | jq -r '.Labels[]? | select(startswith("cloud.docker.run.version="))')
29+
30+ if [ -z "$$OFFLOAD_LABEL" ]; then
31+ echo "❌ Error: Not running in a Docker Offload environment."
32+ echo "Please enable Docker Offload and restart this Labspace"
33+ exit 1
34+ fi
35+
36+ echo "✅ Docker Offload environment detected"
37+
38+ # Check if GPU (nvidia runtime) is available
39+ echo "🔎 Checking GPU availability..."
40+ NVIDIA_RUNTIME=$(echo "$$DOCKER_INFO" | jq -r '.Runtimes.nvidia.path // empty')
41+
42+ if [ -z "$$NVIDIA_RUNTIME" ]; then
43+ echo "❌ Error: GPU not available."
44+ echo "Docker Offload environment is not configured with GPUs. Please enable the GPU setting and try again."
45+ exit 1
46+ fi
47+
48+ echo "✅ GPU available: nvidia runtime found"
49+
50+ echo ""
51+ echo "All checks passed! Environment is ready."
52+ exit 0
You can’t perform that action at this time.
0 commit comments