diff --git a/README.md b/README.md index 463c076..86aa379 100644 --- a/README.md +++ b/README.md @@ -24,6 +24,26 @@ chmod +x install.sh ./install.sh ``` +### Stop and resume + +Stop the sandbox when you are done: + +```bash +container stop coderunner +``` + +Resume the same sandbox later, preserving uploads, kernels, and installed packages: + +```bash +container start coderunner +``` + +To start over with a clean sandbox, delete the container and run the installer again: + +```bash +container delete coderunner && ./install.sh +``` + ## Run Claude Code inside a Sandbox diff --git a/install.sh b/install.sh index cdbc6ea..2726492 100755 --- a/install.sh +++ b/install.sh @@ -82,12 +82,6 @@ echo "Running: container system property set dns.domain local" container system property set dns.domain local -echo "Pulling the latest image: instavm/coderunner" -if ! container image pull instavm/coderunner; then - echo "❌ Failed to pull image. Please check your internet connection and try again." - exit 1 -fi - echo "→ Ensuring coderunner assets directories…" ASSETS_SRC="$HOME/.coderunner/assets" mkdir -p "$ASSETS_SRC/skills/user" @@ -98,14 +92,25 @@ echo "Stopping any existing coderunner container..." container stop coderunner 2>/dev/null || true sleep 2 +echo "Trying to resume any existing coderunner container..." +if container start coderunner 2>/dev/null; then + echo "✅ Setup complete. MCP server is available at http://coderunner.local:8222/mcp" + exit 0 +fi + +echo "Pulling the latest image: instavm/coderunner" +if ! container image pull instavm/coderunner; then + echo "❌ Failed to pull image. Please check your internet connection and try again." + exit 1 +fi + # Run the command to start the sandbox container -echo "Running: container run --name coderunner --detach --rm --cpus 8 --memory 4g instavm/coderunner" +echo "Running: container run --volume \"$ASSETS_SRC/skills/user:/app/uploads/skills/user\" --volume \"$ASSETS_SRC/outputs:/app/uploads/outputs\" --name coderunner --detach --cpus 8 --memory 4g instavm/coderunner" if container run \ --volume "$ASSETS_SRC/skills/user:/app/uploads/skills/user" \ --volume "$ASSETS_SRC/outputs:/app/uploads/outputs" \ --name coderunner \ --detach \ - --rm \ --cpus 8 \ --memory 4g \ instavm/coderunner; then @@ -113,4 +118,4 @@ if container run \ else echo "❌ Failed to start coderunner container. Please check the logs with: container logs coderunner" exit 1 -fi \ No newline at end of file +fi