-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Labels
component-e2bE2B sandbox integrationE2B sandbox integrationenhancementNew feature or requestNew feature or requestphase-2-multi-providerPhase 2: Multi-provider sandbox architecture (v2.5)Phase 2: Multi-provider sandbox architecture (v2.5)priority-mediumMedium priority - next milestoneMedium priority - next milestonetype-featureNew feature implementationNew feature implementation
Description
Overview
Implement a Docker-based sandbox provider for cross-platform sandboxing without cloud costs.
Implementation
// src/e2b/providers/docker-provider.ts
export class DockerProvider implements SandboxProvider {
readonly name = 'docker';
readonly version = '1.0.0';
private defaultImage = 'claude-code:latest';
static async isAvailable(): Promise<boolean> {
try {
execSync('docker info', { stdio: 'pipe' });
return true;
} catch {
return false;
}
}
async create(config: SandboxConfig): Promise<SandboxInstance> {
// docker run -d --name <name> -v <workdir>:/workspace <image>
const containerId = await this.startContainer(config);
return {
id: containerId,
provider: 'docker',
status: SandboxStatus.RUNNING,
createdAt: new Date()
};
}
async execute(instanceId: string, command: string): AsyncGenerator<string> {
// docker exec -t <instanceId> <command>
// Stream output line by line
}
async destroy(instanceId: string): Promise<void> {
// docker stop <instanceId> && docker rm <instanceId>
}
}Docker Image
Create official claude-code Docker image:
# docker/Dockerfile
FROM node:20-slim
# Install Claude CLI
RUN npm install -g @anthropic-ai/claude-code
# Install common development tools
RUN apt-get update && apt-get install -y \
git \
curl \
python3 \
python3-pip
WORKDIR /workspace
# Entry point that keeps container running
ENTRYPOINT ["tail", "-f", "/dev/null"]Configuration
# Use custom image
parallel-cc sandbox-run --provider docker --docker-image my-image:tag
# Resource limits
parallel-cc sandbox-run --provider docker --memory 4g --cpus 2Platform Support
- macOS (Docker Desktop)
- Linux (Docker Engine)
- Windows (Docker Desktop with WSL2)
Files to Create
src/e2b/providers/docker-provider.tsdocker/Dockerfiledocker/docker-compose.yml(for easy local testing)tests/e2b/docker-provider.test.ts
Acceptance Criteria
- Container creation works
- File mounting works correctly
- Command execution with output streaming
- Proper cleanup (stop and remove)
- Works on macOS, Linux, and Windows
- Integration tests pass
Dependencies
- Depends on [v2.5] Define SandboxProvider interface and types #30 (SandboxProvider interface)
- Depends on [v2.5] Add provider registry and factory pattern #32 (Provider registry)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
component-e2bE2B sandbox integrationE2B sandbox integrationenhancementNew feature or requestNew feature or requestphase-2-multi-providerPhase 2: Multi-provider sandbox architecture (v2.5)Phase 2: Multi-provider sandbox architecture (v2.5)priority-mediumMedium priority - next milestoneMedium priority - next milestonetype-featureNew feature implementationNew feature implementation