Problem
The server attempts to create containers from Docker images without checking if those images exist, leading to confusing errors.
Current Behavior
- Server maps scenario IDs to image names
- Directly attempts
docker run without validation
- If image doesn't exist: "Unable to find image 'devopslearn/scenario-keycloak-crashloop:latest' locally"
Expected Behavior
- Server should check if required images are built
- Provide clear error messages if images are missing
- Guide users to run
make scenario-build
Root Cause
In src/server/index.ts, the startScenarioContainer function:
const imageMap: Record<string, string> = {
'k8s-crashloop': 'devopslearn/scenario-keycloak-crashloop',
// ...
};
// No validation before:
const child = spawn('docker', args);
Solution
- Add image existence check before container creation
- Return meaningful error to client if image missing
- Include instructions for building images
Impact
- Poor user experience when images aren't built
- Cryptic Docker errors instead of actionable messages
- Users don't know they need to run
make scenario-build
Problem
The server attempts to create containers from Docker images without checking if those images exist, leading to confusing errors.
Current Behavior
docker runwithout validationExpected Behavior
make scenario-buildRoot Cause
In
src/server/index.ts, thestartScenarioContainerfunction:Solution
Impact
make scenario-build