Skip to content

PURISTA API


PURISTA API / @purista/sandbox / DockerSandboxDriver

Class: DockerSandboxDriver

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:33

DockerSandboxDriver - A robust driver for Docker, OrbStack, and Colima. It provides secure execution environments using Docker containers.

Implements

Constructors

Constructor

new DockerSandboxDriver(config): DockerSandboxDriver

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:40

Parameters

config

DockerSandboxDriverConfig

Driver configuration

Returns

DockerSandboxDriver

Properties

name

name: string = 'DockerSandboxDriver'

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:34

The unique name of the driver implementation

Implementation of

SandboxDriver.name

Methods

createSandbox()

createSandbox(params): Promise<{ containerName: string; sandboxId: string; }>

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:58

Provisions and starts a new Docker container. Securely configures Git identity and GitHub CLI inside the container.

Parameters

params
gitConfig?

{ email: string; token?: string; username: string; }

gitConfig.email

string

gitConfig.token?

string

gitConfig.username

string

organizationId

string

projectId

string

sandboxId

string

userId

string

Returns

Promise<{ containerName: string; sandboxId: string; }>

Implementation of

SandboxDriver.createSandbox


destroySandbox()

destroySandbox(params): Promise<void>

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:165

Forcefully removes the Docker container.

Parameters

params
sandboxId

string

Returns

Promise<void>

Implementation of

SandboxDriver.destroySandbox


executeBash()

executeBash(params): Promise<{ exitCode: number; stderr: string; stdout: string; }>

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:179

Executes a command via 'docker exec'.

Parameters

params
command

string

cwd?

string

sandboxId

string

Returns

Promise<{ exitCode: number; stderr: string; stdout: string; }>

Implementation of

SandboxDriver.executeBash


getContainerName()

getContainerName(sandboxId): string

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:50

Generates the standardized container name for a sandbox.

Parameters

sandboxId

string

Unique sandbox ID

Returns

string


readFile()

readFile(params): Promise<string>

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:212

Reads a file from the container using 'cat'.

Parameters

params
path

string

sandboxId

string

Returns

Promise<string>

Implementation of

SandboxDriver.readFile


scanRunningSandboxes()

scanRunningSandboxes(): Promise<object[]>

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:250

Scans for running containers and recovers metadata from labels.

Returns

Promise<object[]>

Implementation of

SandboxDriver.scanRunningSandboxes


writeFiles()

writeFiles(params): Promise<void>

Defined in: sandbox-service/src/driver/DockerSandboxDriver/DockerSandboxDriver.ts:225

Writes files to the container by creating a local temp file and using 'docker cp'.

Parameters

params
files

Record<string, string>

sandboxId

string

Returns

Promise<void>

Implementation of

SandboxDriver.writeFiles