fix: allow resume of stopped coderunner container#22
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces container persistence by removing the --rm flag from the container run command and adding logic to resume existing containers in install.sh. The README.md has been updated with instructions for stopping and resuming the sandbox. A review comment suggests updating a log message in the installation script to accurately reflect the volume mounts being used, which would improve clarity for users debugging their setup.
|
|
||
| # 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 --name coderunner --detach --cpus 8 --memory 4g instavm/coderunner" |
There was a problem hiding this comment.
The echo message is misleading as it omits the --volume flags that are actually being used in the subsequent container run command. Since persistence is a key feature of this PR, showing the volume mounts in the log (or using a more generic message) would improve clarity for users debugging their setup.
| echo "Running: container run --name coderunner --detach --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" |
The log message printed before starting the coderunner container omitted the --volume mounts that are actually applied. With the volumes added in this PR for state persistence, surfacing them in the echo helps users debug their setup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Fixed in 8462521 — the startup echo now includes both |
|
Thank you! @mvanhorn |
|
Thanks for landing this, @mkagenius. Resume-on-stopped was a niggle worth fixing. |
|
@mkagenius appreciate the container-resume fix. Dropping |
Summary
install.shalways launched the sandbox withcontainer run --rm, which destroys the container oncontainer stop. There was no documented or supported path to stop the sandbox and resume it later: the next./install.shrancontainer image pullandcontainer run --rmagain, starting from a fresh state every time.Two changes:
container start coderunnerat the top ofinstall.sh. If the container exists, resume it and exit early. If it doesn't, fall through to the pull + run path.--rmfromcontainer runso the sandbox survives acontainer stop.README adds a
## Stop and resumesection documenting both paths (resume the same sandbox, orcontainer delete+ re-install for a clean start).Why this matters
#4 (filed by @mkagenius in July 2025) asks for the ability to resume coderunner after stopping it. The current install script makes that impossible by design (
--rm). Keeping uploads, kernels, and pip-installed packages across restarts is a reasonable workflow for an MCP-served sandbox; the alternative is reinstalling deps every restart, which defeats the persistent-assets dir the installer already creates at~/.coderunner/assets.Closes #4