Starting Docker Sandboxes with Specified Memory and CPU
I might be playing with Docker Sandboxes for a while.
Docker Sandboxes is a tool that provides a sandbox environment to safely run AI programming tools like Codex, Claude Code, and OpenCode. It’s created by Docker, but it’s not a container. It’s described as a very small virtual environment.
This makes me curious about how the CPU core count and memory allocation work.
The answers are written in dockerdocs.
-
–cpus : Number of CPUs to allocate to the sandbox (0 = auto: all host CPUs)
-
-m, –memory : Memory limit in binary units (e.g., 1024m, 8g). Default: 50% of host memory, max 32 GiB
-
CPU: Default is all host CPUs
-
Memory: Default is 50% of host memory
According to this, since I’ve allocated 24GB to WSL, I probably have 12GB allocated to the sandbox. Since I’m not going to use anything else, I think I could allocate more.
$ sbx run opencode -m 20g -cpus 10
The note is that you can only specify these settings during the first startup of each project. If you’ve already started it once, you need to delete it first and then restart with the specified CPU core count and memory.
Comments
No comments yet.