feat(sandbox): replace one-shot docker run with session-scoped containers - #2769
Open
lyingbug wants to merge 1 commit into
Open
feat(sandbox): replace one-shot docker run with session-scoped containers#2769lyingbug wants to merge 1 commit into
lyingbug wants to merge 1 commit into
Conversation
将 Docker 沙箱后端从一次性 exec 容器改为会话级长驻容器,使其会话与文件 系统语义与 E2B / Cube 后端对齐: - 新增 docker_engine / docker_remote_client / docker_rpc_timeout,直连 Docker Engine API,支持 TCP+TLS 远程守护进程,并为拉镜像等慢操作单独 设置超时;daemon 地址留空时跟随本机 docker context。 - 新增空闲清理器 docker_idle_sweeper,按 exec 刷新的活跃标记回收长驻 容器;标记文件对沙箱非 root 账号可写。 - 会话容器补 PID1 以回收僵尸进程;标准镜像补入 curl。 - 镜像即模板:docker_template_catalog 只上报可识别的沙箱镜像,标准模板 的拉取在后台进行并报告 building。 - 设置页与租户配置支持守护进程地址、TLS 与 CPU/内存限额,四种语言文案 同步;沙箱健康检查覆盖 Docker 后端。 - 补充 docs/sandbox-docker-backend.md 与 POC,说明能力边界与快照语义; git 钩子的变更包检测跳过嵌套 module,避免拿 POC 的包去跑主 module 测试。
lyingbug
force-pushed
the
docker-sandbox
branch
from
August 21, 2026 11:44
85b815b to
d9413e2
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docker run --rminto aRemoteSandboxClient: one long-lived container per session, soshell_exec, attachments, and artifact collection match Cube/E2B.timeout(1)so client cancel actually kills in-container work; files go through the Engine archive API; idle containers are reaped from an activity-marker mtime.DOCKER_HOST, then the currentdocker context) so Colima and Docker Desktop work without pasting a socket path. Remotetcp://daemons require TLS;host/container:network modes are rejected.curl(egress check) and creates containers with root PID 1 so the activity marker is writable underUSER user. Image pulls are no longer killed by the 30s HTTP client timeout.Test plan
docker psworks (Linux socket, Colima, or Docker Desktop)wechatopenai/weknora-sandbox:latestfromdocker/Dockerfile.sandboxand confirm deep check (including egress) passesshell_exectwice, confirm packages/files survive; wait past idle TTL and confirm the container is reclaimedtcp://host without a TLS cert directory is rejected;network_mode=hostis rejectedgo test ./internal/sandbox/ ./internal/handler/go test -tags=docker_integration ./internal/sandbox/against a reachable daemon