
Product
Introducing Repository Access Permissions and Custom Roles
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.
@mastra/docker
Advanced tools
Affected versions:
Docker container sandbox provider for Mastra workspaces. Uses long-lived containers with docker exec for command execution. Targets local development, CI/CD, air-gapped deployments, and cost-sensitive scenarios where cloud sandboxes are unnecessary.
npm install @mastra/docker
Requires Docker Engine running on the host machine.
import { Agent } from '@mastra/core/agent';
import { Workspace } from '@mastra/core/workspace';
import { DockerSandbox } from '@mastra/docker';
const workspace = new Workspace({
sandbox: new DockerSandbox({
image: 'node:22-slim',
timeout: 60_000, // 60 second timeout (default: 5 minutes)
}),
});
const agent = new Agent({
name: 'my-agent',
model: 'anthropic/claude-opus-4-6',
workspace,
});
Mount host directories into the container:
const workspace = new Workspace({
sandbox: new DockerSandbox({
image: 'node:22-slim',
volumes: {
'/my/project': '/workspace/project',
'/shared/data': '/data',
},
}),
});
Containers can be reconnected by providing a fixed id. On start(), an existing container with a matching label is reused instead of creating a new one:
const workspace = new Workspace({
sandbox: new DockerSandbox({
id: 'persistent-sandbox',
image: 'node:22-slim',
}),
});
Connect to remote Docker hosts or use custom socket paths:
const workspace = new Workspace({
sandbox: new DockerSandbox({
dockerOptions: {
host: '192.168.1.100',
port: 2376,
},
}),
});
For more information, see the DockerSandbox reference.
FAQs
Docker container sandbox provider for Mastra workspaces
The npm package @mastra/docker receives a total of 2,268 weekly downloads. As such, @mastra/docker popularity was classified as popular.
We found that @mastra/docker demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 6 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.

Product
Socket Firewall blocks malicious VS Code and Open VSX extensions before install, protecting developers from compromised editor marketplaces.