Skip to content

Commit c152b60

Browse files
authored
Merge pull request #23700 from dvdksn/docker-sandboxes
docker sandboxes
2 parents e53126e + fabb108 commit c152b60

File tree

24 files changed

+1364
-85
lines changed

24 files changed

+1364
-85
lines changed

_vale/config/vocabularies/Docker/accept.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
(?i)[A-Z]{2,}'?s
2-
2+
jq
3+
ripgrep
4+
sandboxing
35
Adreno
46
Aleksandrov
57
Amazon

content/manuals/ai/compose/_index.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
build:
33
render: never
44
title: AI and Docker Compose
5-
weight: 40
5+
weight: 50
66
params:
77
sidebar:
88
group: AI
9-
---
9+
---

content/manuals/ai/gordon/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Ask Gordon
33
description: Streamline your workflow with Docker's AI-powered assistant in Docker Desktop and CLI.
4-
weight: 10
4+
weight: 40
55
params:
66
sidebar:
77
badge:

content/manuals/ai/mcp-catalog-and-toolkit/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ params:
77
badge:
88
color: blue
99
text: Beta
10-
weight: 30
10+
weight: 10
1111
description: Learn about Docker's MCP catalog on Docker Hub
1212
keywords: Docker, ai, mcp servers, ai agents, extension, docker desktop, llm, docker hub
1313
grid:

content/manuals/ai/mcp-catalog-and-toolkit/sandboxes.md renamed to content/manuals/ai/mcp-catalog-and-toolkit/e2b-sandboxes.md

Lines changed: 62 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,18 @@
11
---
2-
title: Sandboxes
3-
description: "Learn how sandboxes provide secure, isolated execution environments for AI agents in the MCP ecosystem, enabling safe code execution and protecting production systems."
4-
keywords: Sandboxes, E2B, MCP Gateway, isolated environment, AI agent security
5-
params:
6-
sidebar:
7-
badge:
8-
color: green
9-
text: New
10-
weight: 50
2+
title: E2B sandboxes
3+
description: Cloud-based secure sandboxes for AI agents with built-in Docker MCP Gateway integration
4+
keywords: E2B, cloud sandboxes, MCP Gateway, AI agents, MCP Catalog
5+
aliases:
6+
- /ai/mcp-catalog-and-toolkit/sandboxes/
117
---
128

13-
Sandboxes are isolated execution environments that provide secure, controlled spaces for running code and applications without affecting the host system. They create strict boundaries around executing processes, preventing access to unauthorized resources while providing consistent, reproducible environments. Think of it as a virtual "playground" with clearly defined boundaries, where code can execute freely within those boundaries but cannot escape to impact other systems or access sensitive data.
9+
Docker has partnered with [E2B](https://e2b.dev/), a provider of secure cloud sandboxes for AI agents. Through this partnership, every E2B sandbox includes direct access to Docker's [MCP Catalog](https://hub.docker.com/mcp), a collection of 200+ tools from publishers including GitHub, Notion, and Stripe.
1410

15-
In the Model Context Protocol ecosystem, sandboxes address several critical challenges that arise when AI agents need to execute code or interact with external systems. They enable safe code execution for AI-generated scripts, secure tool validation for MCP servers, and multi-tenant isolation when multiple agents share infrastructure. This ensures that sensitive credentials and data remain protected within appropriate security boundaries while maintaining compliance and audit requirements.
16-
17-
## Key features
18-
19-
- Isolation and Security: Complete separation between executing code and the host environment, with strict controls over file access, network connections, and system calls.
20-
- Resource Management: Fine-grained control over CPU, memory, disk space, and network usage to prevent resource exhaustion.
21-
- Reproducible Environments: Consistent, predictable execution environments. Code that runs successfully in one sandbox instance will behave identically in another.
22-
- Ephemeral Environments: Temporary, disposable environments that can be destroyed after task completion, leaving no persistent artifacts.
23-
24-
## E2B sandboxes
25-
26-
Docker has partnered with [E2B](https://e2b.dev/), a provider of secure cloud sandboxes for AI agents. Through this partnership, every E2B sandbox now includes direct access to Docker’s [MCP Catalog](https://hub.docker.com/mcp), a collection of 200+ tools, including ones from known publishers such as GitHub, Notion, and Stripe, all enabled through the Docker MCP Gateway.
27-
28-
When creating a new sandbox, E2B users can specify which MCP tools the sandbox should access. E2B then launches these MCP tools and provides access through the Docker MCP Gateway.
29-
30-
The following example shows how to set up an E2B sandbox with GitHub and Notion MCP servers.
11+
When you create a sandbox, you specify which MCP tools it should access. E2B launches these tools and provides access through the Docker MCP Gateway.
3112

3213
## Example: Using GitHub and Notion MCP server
3314

34-
The following example demonstrates how to analyze data in Notion and create GitHub issues. By the end, you'll understand how to connect multiple MCP servers in an E2B sandbox and orchestrate cross-platform workflows.
15+
This example demonstrates how to connect multiple MCP servers in an E2B sandbox. You'll analyze data in Notion and create GitHub issues using Claude.
3516

3617
### Prerequisites
3718

@@ -40,29 +21,28 @@ Before you begin, make sure you have the following:
4021
- [E2B account](https://e2b.dev/docs/quickstart) with API access
4122
- Anthropic API key for Claude
4223

43-
>[!Note]
44-
>
45-
> This example uses Claude CLI which comes pre-installed in E2B sandboxes. However,
46-
> you can adapt the example to work with other AI assistants of your choice. See
47-
> [E2B's MCP documentation](https://e2b.dev/docs/mcp/quickstart) for alternative
48-
> connection methods.
24+
> [!NOTE]
25+
> This example uses Claude Code which comes pre-installed in E2B sandboxes.
26+
> However, you can adapt the example to work with other AI assistants of your
27+
> choice. See [E2B's MCP documentation](https://e2b.dev/docs/mcp/quickstart)
28+
> for alternative connection methods.
4929
5030
- Node.js 18+ installed on your machine
5131
- Notion account with:
5232
- A database containing sample data
5333
- [Integration token](https://www.notion.com/help/add-and-manage-connections-with-the-api)
5434
- GitHub account with:
55-
- A repository for testing
56-
- Personal access token with `repo` scope
35+
- A repository for testing
36+
- Personal access token with `repo` scope
5737

5838
### Set up your environment
5939

6040
Create a new directory and initialize a Node.js project:
6141

62-
```bash
63-
mkdir mcp-e2b-quickstart
64-
cd mcp-e2b-quickstart
65-
npm init -y
42+
```console
43+
$ mkdir mcp-e2b-quickstart
44+
$ cd mcp-e2b-quickstart
45+
$ npm init -y
6646
```
6747

6848
Configure your project for ES modules by updating `package.json`:
@@ -80,24 +60,26 @@ Configure your project for ES modules by updating `package.json`:
8060

8161
Install required dependencies:
8262

83-
```bash
84-
npm install e2b dotenv
63+
```console
64+
$ npm install e2b dotenv
8565
```
8666

8767
Create a `.env` file with your credentials:
8868

89-
```bash
69+
```console
70+
$ cat > .env << 'EOF'
9071
E2B_API_KEY=your_e2b_api_key_here
9172
ANTHROPIC_API_KEY=your_anthropic_api_key_here
9273
NOTION_INTEGRATION_TOKEN=ntn_your_notion_integration_token_here
9374
GITHUB_TOKEN=ghp_your_github_pat_here
75+
EOF
9476
```
9577

9678
Protect your credentials:
9779

98-
```bash
99-
echo ".env" >> .gitignore
100-
echo "node_modules/" >> .gitignore
80+
```console
81+
$ echo ".env" >> .gitignore
82+
$ echo "node_modules/" >> .gitignore
10183
```
10284

10385
### Create an E2B sandbox with MCP servers
@@ -108,8 +90,8 @@ echo "node_modules/" >> .gitignore
10890
Create a file named `index.ts`:
10991

11092
```typescript
111-
import 'dotenv/config';
112-
import { Sandbox } from 'e2b';
93+
import "dotenv/config";
94+
import { Sandbox } from "e2b";
11395

11496
async function quickstart(): Promise<void> {
11597
console.log("Creating E2B sandbox with Notion and GitHub MCP servers...\n");
@@ -120,7 +102,8 @@ async function quickstart(): Promise<void> {
120102
},
121103
mcp: {
122104
notion: {
123-
internalIntegrationToken: process.env.NOTION_INTEGRATION_TOKEN as string,
105+
internalIntegrationToken: process.env
106+
.NOTION_INTEGRATION_TOKEN as string,
124107
},
125108
githubOfficial: {
126109
githubPersonalAccessToken: process.env.GITHUB_TOKEN as string,
@@ -135,17 +118,17 @@ async function quickstart(): Promise<void> {
135118
console.log(`MCP Gateway URL: ${mcpUrl}\n`);
136119

137120
// Wait for MCP initialization
138-
await new Promise<void>(resolve => setTimeout(resolve, 1000));
121+
await new Promise<void>((resolve) => setTimeout(resolve, 1000));
139122

140-
// Connect Claude CLI to MCP gateway
141-
console.log("Connecting Claude CLI to MCP gateway...");
123+
// Connect Claude to MCP gateway
124+
console.log("Connecting Claude to MCP gateway...");
142125
await sbx.commands.run(
143126
`claude mcp add --transport http e2b-mcp-gateway ${mcpUrl} --header "Authorization: Bearer ${mcpToken}"`,
144127
{
145128
timeoutMs: 0,
146129
onStdout: console.log,
147-
onStderr: console.log
148-
}
130+
onStderr: console.log,
131+
},
149132
);
150133

151134
console.log("\nConnection successful! Cleaning up...");
@@ -157,8 +140,8 @@ quickstart().catch(console.error);
157140

158141
Run the script:
159142

160-
```typescript
161-
npx tsx index.ts
143+
```console
144+
$ npx tsx index.ts
162145
```
163146

164147
{{< /tab >}}
@@ -200,8 +183,8 @@ async def quickstart():
200183
# Wait for MCP initialization
201184
await asyncio.sleep(1)
202185

203-
# Connect Claude CLI to MCP gateway
204-
print("Connecting Claude CLI to MCP gateway...")
186+
# Connect Claude to MCP gateway
187+
print("Connecting Claude to MCP gateway...")
205188

206189
def on_stdout(output):
207190
print(output, end='')
@@ -229,22 +212,22 @@ if __name__ == "__main__":
229212

230213
Run the script:
231214

232-
```python
233-
python index.py
215+
```console
216+
$ python index.py
234217
```
235218

236219
{{< /tab >}}
237220
{{</tabs >}}
238221

239222
You should see:
240223

241-
```bash
224+
```console
242225
Creating E2B sandbox with Notion and GitHub MCP servers...
243226

244227
Sandbox created successfully!
245228
MCP Gateway URL: https://50005-xxxxx.e2b.app/mcp
246229

247-
Connecting Claude CLI to MCP gateway...
230+
Connecting Claude to MCP gateway...
248231
Added HTTP MCP server e2b-mcp-gateway with URL: https://50005-xxxxx.e2b.app/mcp
249232

250233
Connection successful! Cleaning up...
@@ -257,16 +240,16 @@ Now, test the setup by running a simple workflow that searches Notion and create
257240
{{< tabs group="" >}}
258241
{{< tab name="Typescript">}}
259242

260-
>[!IMPORTANT]
243+
> [!IMPORTANT]
261244
>
262245
> Replace `owner/repo` in the prompt with your actual GitHub username and repository
263246
> name (for example, `yourname/test-repo`).
264247
265248
Update `index.ts` with the following example:
266249

267250
```typescript
268-
import 'dotenv/config';
269-
import { Sandbox } from 'e2b';
251+
import "dotenv/config";
252+
import { Sandbox } from "e2b";
270253

271254
async function exampleWorkflow(): Promise<void> {
272255
console.log("Creating sandbox...\n");
@@ -277,7 +260,8 @@ async function exampleWorkflow(): Promise<void> {
277260
},
278261
mcp: {
279262
notion: {
280-
internalIntegrationToken: process.env.NOTION_INTEGRATION_TOKEN as string,
263+
internalIntegrationToken: process.env
264+
.NOTION_INTEGRATION_TOKEN as string,
281265
},
282266
githubOfficial: {
283267
githubPersonalAccessToken: process.env.GITHUB_TOKEN as string,
@@ -291,16 +275,16 @@ async function exampleWorkflow(): Promise<void> {
291275
console.log("Sandbox created successfully\n");
292276

293277
// Wait for MCP servers to initialize
294-
await new Promise<void>(resolve => setTimeout(resolve, 3000));
278+
await new Promise<void>((resolve) => setTimeout(resolve, 3000));
295279

296280
console.log("Connecting Claude to MCP gateway...\n");
297281
await sbx.commands.run(
298282
`claude mcp add --transport http e2b-mcp-gateway ${mcpUrl} --header "Authorization: Bearer ${mcpToken}"`,
299283
{
300284
timeoutMs: 0,
301285
onStdout: console.log,
302-
onStderr: console.log
303-
}
286+
onStderr: console.log,
287+
},
304288
);
305289

306290
console.log("\nRunning example: Search Notion and create GitHub issue...\n");
@@ -315,8 +299,8 @@ async function exampleWorkflow(): Promise<void> {
315299
{
316300
timeoutMs: 0,
317301
onStdout: console.log,
318-
onStderr: console.log
319-
}
302+
onStderr: console.log,
303+
},
320304
);
321305

322306
await sbx.kill();
@@ -327,16 +311,16 @@ exampleWorkflow().catch(console.error);
327311

328312
Run the script:
329313

330-
```typescript
331-
npx tsx index.ts
314+
```console
315+
$ npx tsx index.ts
332316
```
333317

334318
{{< /tab >}}
335319
{{< tab name="Python">}}
336320

337321
Update `index.py` with this example:
338322

339-
>[!IMPORTANT]
323+
> [!IMPORTANT]
340324
>
341325
> Replace `owner/repo` in the prompt with your actual GitHub username and repository
342326
> name (for example, `yourname/test-repo`).
@@ -418,16 +402,16 @@ if __name__ == "__main__":
418402

419403
Run the script:
420404

421-
```bash
422-
python workflow.py
405+
```console
406+
$ python workflow.py
423407
```
424408

425409
{{< /tab >}}
426410
{{</tabs >}}
427411

428412
You should see:
429413

430-
```bash
414+
```console
431415
Creating sandbox...
432416

433417
Running example: Search Notion and create GitHub issue...
@@ -456,14 +440,13 @@ Successfully created test issue:
456440
Both operations completed successfully. The MCP servers are properly configured and working.
457441
```
458442

459-
You've successfully created an E2B sandbox with multiple MCP servers and used Claude to orchestrate a workflow across Notion and GitHub.
460-
461-
You can extend this example to combine any of the 200+ MCP servers in the Docker MCP Catalog to build sophisticated automation workflows for your specific needs.
443+
The sandbox connected multiple MCP servers and orchestrated a workflow across Notion and GitHub. You can extend this pattern to combine any of the 200+ MCP servers in the Docker MCP Catalog.
462444

463445
## Related pages
464446

465447
- [How to build an AI-powered code quality workflow with SonarQube and E2B](/guides/github-sonarqube-sandbox.md)
466448
- [Docker + E2B: Building the Future of Trusted AI](https://www.docker.com/blog/docker-e2b-building-the-future-of-trusted-ai/)
449+
- [Docker Sandboxes](/manuals/ai/sandboxes/_index.md)
467450
- [Docker MCP Toolkit and Catalog](/manuals/ai/mcp-catalog-and-toolkit/_index.md)
468451
- [Docker MCP Gateway](/manuals/ai/mcp-catalog-and-toolkit/mcp-gateway.md)
469452
- [E2B MCP documentation](https://e2b.dev/docs/mcp)

content/manuals/ai/model-runner/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ linkTitle: Model Runner
44
params:
55
sidebar:
66
group: AI
7-
weight: 20
7+
weight: 30
88
description: Learn how to use Docker Model Runner to manage and run AI models.
99
keywords: Docker, ai, model runner, docker desktop, docker engine, llm
1010
aliases:

0 commit comments

Comments
 (0)