🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@mastra/docker

Package Overview
Dependencies
Maintainers
1
Versions
85
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
Package version was removed
This package version has been unpublished, mostly likely due to security reasons
This package has malicious versions linked to the ongoing "Mastra AI framework compromise" supply chain attack.

Affected versions:

0.3.1
View campaign page

@mastra/docker

Docker container sandbox provider for Mastra workspaces

unpublished
Source
npmnpm
Version
0.3.1
Version published
Weekly downloads
2.5K
70.74%
Maintainers
1
Weekly downloads
 
Created
Source

@mastra/docker

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.

Installation

npm install @mastra/docker

Requires Docker Engine running on the host machine.

Usage

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,
});

Bind Mounts

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',
    },
  }),
});

Reconnection

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',
  }),
});

Docker Connection Options

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,
    },
  }),
});

Documentation

For more information, see the DockerSandbox reference.

FAQs

Package last updated on 17 Jun 2026

Did you know?

Socket

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.

Install

Related posts