docs: remove E2B and Ollama guides

Remove the E2B workflow and integration documentation and both Ollama
application guides. Remove E2B navigation and promotional links.

Redirect former E2B URLs to Docker Sandboxes and former Ollama guide URLs
to Docker Model Runner.
This commit is contained in:
David Karlsson committed 2026-10-08 14:17:22 +00:00
1 parent 5542bb1ed4
commit 19b44c2f42
8 files changed
+15 -3423

No files matched your search

-534
View File
@@ -1,534 +0,0 @@
---
title: PDF analysis and chat
description: Containerize generative AI (GenAI) apps using Docker
keywords: python, generative ai, genai, llm, neo4j, ollama, langchain
summary: |
Learn how to build a PDF bot for parsing PDF documents and generating
responses using Docker and generative AI.
aliases:
- /guides/use-case/genai-pdf-bot/
- /guides/genai-pdf-bot/containerize/
- /guides/genai-pdf-bot/develop/
params:
tags: [ai]
time: 20 minutes
---
The generative AI (GenAI) guide teaches you how to containerize an existing GenAI application using Docker. In this guide, you’ll learn how to:
- Containerize and run a Python-based GenAI application
- Set up a local environment to run the complete GenAI stack locally for development
Start by containerizing an existing GenAI application.
## Containerize a generative AI application
### Prerequisites
> [!NOTE]
>
> GenAI applications can often benefit from GPU acceleration. Currently Docker Desktop supports GPU acceleration only on [Windows with the WSL2 backend](/manuals/desktop/features/gpu.md#using-nvidia-gpus-with-wsl2). Linux users can also access GPU acceleration using a native installation of the [Docker Engine](/manuals/engine/install/_index.md).
- You have installed the latest version of [Docker Desktop](/get-started/get-docker.md) or, if you are a Linux user and are planning to use GPU acceleration, [Docker Engine](/manuals/engine/install/_index.md). Docker adds new features regularly and some parts of this guide may work only with the latest version of Docker Desktop.
- You have a [git client](https://git-scm.com/downloads). The examples in this section use a command-line based git client, but you can use any client.
### Overview
This section walks you through containerizing a generative AI (GenAI) application using Docker Desktop.
> [!NOTE]
>
> You can see more samples of containerized GenAI applications in the [GenAI Stack](https://github.com/docker/genai-stack) demo applications.
### Get the sample application
The sample application used in this guide is a modified version of the PDF Reader application from the [GenAI Stack](https://github.com/docker/genai-stack) demo applications. The application is a full stack Python application that lets you ask questions about a PDF file.
The application uses [LangChain](https://www.langchain.com/) for orchestration, [Streamlit](https://streamlit.io/) for the UI, [Ollama](https://ollama.ai/) to run the LLM, and [Neo4j](https://neo4j.com/) to store vectors.
Clone the sample application. Open a terminal, change directory to a directory that you want to work in, and run the following command to clone the repository:
```console
$ git clone https://github.com/craig-osterhout/docker-genai-sample
```
You should now have the following files in your `docker-genai-sample` directory.
```text
├── docker-genai-sample/
│ ├── .gitignore
│ ├── app.py
│ ├── chains.py
│ ├── env.example
│ ├── requirements.txt
│ ├── util.py
│ ├── LICENSE
│ └── README.md
```
### Create Docker assets
Now that you have an application, you can create the necessary Docker assets to
containerize it.
> [!TIP]
>
> [Gordon](/ai/gordon/), Docker's AI assistant, can generate Docker assets for your project. Ask Gordon to create a Dockerfile, Compose file, and `.dockerignore` tailored to your application.
Create the following files in your `docker-genai-sample` directory.
```dockerfile {collapse=true,title=Dockerfile}
# syntax=docker/dockerfile:1
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Dockerfile reference guide at
# https://docs.docker.com/go/dockerfile-reference/
ARG PYTHON_VERSION=3.11.4
FROM python:${PYTHON_VERSION}-slim as base
# Prevents Python from writing pyc files.
ENV PYTHONDONTWRITEBYTECODE=1
# Keeps Python from buffering stdout and stderr to avoid situations where
# the application crashes without emitting any logs due to buffering.
ENV PYTHONUNBUFFERED=1
WORKDIR /app
# Create a non-privileged user that the app will run under.
# See https://docs.docker.com/go/dockerfile-user-best-practices/
ARG UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
appuser
# Download dependencies as a separate step to take advantage of Docker's caching.
# Leverage a cache mount to /root/.cache/pip to speed up subsequent builds.
# Leverage a bind mount to requirements.txt to avoid having to copy them into
# into this layer.
RUN --mount=type=cache,target=/root/.cache/pip \
--mount=type=bind,source=requirements.txt,target=requirements.txt \
python -m pip install -r requirements.txt
# Switch to the non-privileged user to run the application.
USER appuser
# Copy the source code into the container.
COPY . .
# Expose the port that the application listens on.
EXPOSE 8000
# Run the application.
CMD ["streamlit", "run", "app.py", "--server.address=0.0.0.0", "--server.port=8000"]
```
```yaml {collapse=true,title=compose.yaml}
# Comments are provided throughout this file to help you get started.
# If you need more help, visit the Docker Compose reference guide at
# https://docs.docker.com/go/compose-spec-reference/
# Here the instructions define your application as a service called "server".
# This service is built from the Dockerfile in the current directory.
# You can add other services your application may depend on here, such as a
# database or a cache. For examples, see the Awesome Compose repository:
# https://github.com/docker/awesome-compose
services:
server:
build:
context: .
ports:
- 8000:8000
# The commented out section below is an example of how to define a PostgreSQL
# database that your application can use. `depends_on` tells Docker Compose to
# start the database before your application. The `db-data` volume persists the
# database data between container restarts. The `db-password` secret is used
# to set the database password. You must create `db/password.txt` and add
# a password of your choosing to it before running `docker compose up`.
# depends_on:
# db:
# condition: service_healthy
# db:
# image: postgres
# restart: always
# user: postgres
# secrets:
# - db-password
# volumes:
# - db-data:/var/lib/postgresql/data
# environment:
# - POSTGRES_DB=example
# - POSTGRES_PASSWORD_FILE=/run/secrets/db-password
# expose:
# - 5432
# healthcheck:
# test: [ "CMD", "pg_isready" ]
# interval: 10s
# timeout: 5s
# retries: 5
# volumes:
# db-data:
# secrets:
# db-password:
# file: db/password.txt
```
```text {collapse=true,title=".dockerignore"}
# Include any files or directories that you don't want to be copied to your
# container here (e.g., local build artifacts, temporary files, etc.).
#
# For more help, visit the .dockerignore file reference guide at
# https://docs.docker.com/go/build-context-dockerignore/
**/.DS_Store
**/__pycache__
**/.venv
**/.classpath
**/.dockerignore
**/.env
**/.git
**/.gitignore
**/.project
**/.settings
**/.toolstarget
**/.vs
**/.vscode
**/*.*proj.user
**/*.dbmdl
**/*.jfm
**/bin
**/charts
**/docker-compose*
**/compose.y*ml
**/Dockerfile*
**/node_modules
**/npm-debug.log
**/obj
**/secrets.dev.yaml
**/values.dev.yaml
LICENSE
README.md
```
You should now have the following contents in your `docker-genai-sample`
directory.
```text
├── docker-genai-sample/
│ ├── .dockerignore
│ ├── .gitignore
│ ├── app.py
│ ├── chains.py
│ ├── compose.yaml
│ ├── env.example
│ ├── requirements.txt
│ ├── util.py
│ ├── Dockerfile
│ ├── LICENSE
│ └── README.md
```
To learn more about these files, see the following:
- [Dockerfile](../../../reference/dockerfile.md)
- [.dockerignore](../../../reference/dockerfile.md#dockerignore-file)
- [compose.yaml](/reference/compose-file/_index.md)
### Run the application
Inside the `docker-genai-sample` directory, run the following command in a
terminal.
```console
$ docker compose up --build
```
Docker builds and runs your application. Depending on your network connection, it may take several minutes to download all the dependencies. You'll see a message like the following in the terminal when the application is running.
```console
server-1 | You can now view your Streamlit app in your browser.
server-1 |
server-1 | URL: http://0.0.0.0:8000
server-1 |
```
Open a browser and view the application at [http://localhost:8000](http://localhost:8000). You should see a simple Streamlit application. The application may take a few minutes to download the embedding model. While the download is in progress, **Running** appears in the top-right corner.
The application requires a Neo4j database service and an LLM service to
function. If you have access to services that you ran outside of Docker, specify
the connection information and try it out. If you don't have the services
running, continue with this guide to learn how you can run some or all of these
services with Docker.
In the terminal, press `ctrl`+`c` to stop the application.
### Summary
In this section, you learned how you can containerize and run your GenAI
application using Docker.
### Next steps
In the next section, you'll learn how you can run your application, database, and LLM service all locally using Docker.
## Use containers for generative AI development
### Prerequisites
Complete [Containerize a generative AI application](#containerize-a-generative-ai-application).
### Overview
In this section, you'll learn how to set up a development environment to access all the services that your generative AI (GenAI) application needs. This includes:
- Adding a local database
- Adding a local or remote LLM service
> [!NOTE]
>
> You can see more samples of containerized GenAI applications in the [GenAI Stack](https://github.com/docker/genai-stack) demo applications.
### Add a local database
You can use containers to set up local services, like a database. In this section, you'll update the `compose.yaml` file to define a database service. In addition, you'll specify an environment variables file to load the database connection information rather than manually entering the information every time.
To run the database service:
1. In the cloned repository's directory, rename `env.example` file to `.env`.
This file contains the environment variables that the containers will use.
2. In the cloned repository's directory, open the `compose.yaml` file in an IDE or text editor.
3. In the `compose.yaml` file, add the following:
- Add instructions to run a Neo4j database
- Specify the environment file under the server service in order to pass in the environment variables for the connection
The following is the updated `compose.yaml` file. All comments have been removed.
```yaml{hl_lines=["7-23"]}
services:
server:
build:
context: .
ports:
- 8000:8000
env_file:
- .env
depends_on:
database:
condition: service_healthy
database:
image: neo4j:5.11
ports:
- "7474:7474"
- "7687:7687"
environment:
- NEO4J_AUTH=${NEO4J_USERNAME}/${NEO4J_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "wget --no-verbose --tries=1 --spider localhost:7474 || exit 1"]
interval: 5s
timeout: 3s
retries: 5
```
> [!NOTE]
>
> To learn more about Neo4j, see the [Neo4j Official Docker Image](https://hub.docker.com/_/neo4j).
4. Run the application. Inside the `docker-genai-sample` directory,
run the following command in a terminal.
```console
$ docker compose up --build
```
5. Access the application. Open a browser and view the application at [http://localhost:8000](http://localhost:8000). You should see a simple Streamlit application. Note that asking questions to a PDF will cause the application to fail because the LLM service specified in the `.env` file isn't running yet.
6. Stop the application. In the terminal, press `ctrl`+`c` to stop the application.
### Add a local or remote LLM service
The sample application supports both [Ollama](https://ollama.ai/) and [OpenAI](https://openai.com/). This guide provides instructions for the following scenarios:
- Run Ollama in a container
- Run Ollama outside of a container
- Use OpenAI
While all platforms can use any of the previous scenarios, the performance and
GPU support may vary. You can use the following guidelines to help you choose the appropriate option:
- Run Ollama in a container if you're on Linux, and using a native installation of the Docker Engine, or Windows 10/11, and using Docker Desktop, you
have a CUDA-supported GPU, and your system has at least 8 GB of RAM.
- Run Ollama outside of a container if you're on an Apple silicon Mac.
- Use OpenAI if the previous two scenarios don't apply to you.
Choose one of the following options for your LLM service.
{{< tabs >}}
{{< tab name="Run Ollama in a container" >}}
When running Ollama in a container, you should have a CUDA-supported GPU. While you can run Ollama in a container without a supported GPU, the performance may not be acceptable. Only Linux and Windows 11 support GPU access to containers.
To run Ollama in a container and provide GPU access:
1. Install the prerequisites.
- For Docker Engine on Linux, install the [NVIDIA Container Toolkit](https://github.com/NVIDIA/nvidia-container-toolkit).
- For Docker Desktop on Windows 10/11, install the latest [NVIDIA driver](https://www.nvidia.com/Download/index.aspx) and make sure you are using the [WSL2 backend](/manuals/desktop/features/wsl/_index.md#turn-on-docker-desktop-wsl-2)
2. Add the Ollama service and a volume in your `compose.yaml`. The following is
the updated `compose.yaml`:
```yaml {hl_lines=["24-38"]}
services:
server:
build:
context: .
ports:
- 8000:8000
env_file:
- .env
depends_on:
database:
condition: service_healthy
database:
image: neo4j:5.11
ports:
- "7474:7474"
- "7687:7687"
environment:
- NEO4J_AUTH=${NEO4J_USERNAME}/${NEO4J_PASSWORD}
healthcheck:
test:
[
"CMD-SHELL",
"wget --no-verbose --tries=1 --spider localhost:7474 || exit 1",
]
interval: 5s
timeout: 3s
retries: 5
ollama:
image: ollama/ollama:latest
ports:
- "11434:11434"
volumes:
- ollama_volume:/root/.ollama
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: all
capabilities: [gpu]
volumes:
ollama_volume:
```
> [!NOTE]
>
> For more details about the Compose instructions, see [Turn on GPU access with Docker Compose](/manuals/compose/how-tos/gpu-support.md).
3. Add the ollama-pull service to your `compose.yaml` file. This service uses
the `docker/genai:ollama-pull` image, based on the GenAI Stack's
[pull_model.Dockerfile](https://github.com/docker/genai-stack/blob/main/pull_model.Dockerfile).
The service will automatically pull the model for your Ollama
container. The following is the updated section of the `compose.yaml` file:
```yaml {hl_lines=["12-17"]}
services:
server:
build:
context: .
ports:
- 8000:8000
env_file:
- .env
depends_on:
database:
condition: service_healthy
ollama-pull:
condition: service_completed_successfully
ollama-pull:
image: docker/genai:ollama-pull
env_file:
- .env
# ...
```
{{< /tab >}}
{{< tab name="Run Ollama outside of a container" >}}
To run Ollama outside of a container:
1. [Install](https://github.com/jmorganca/ollama) and run Ollama on your host
machine.
2. Update the `OLLAMA_BASE_URL` value in your `.env` file to
`http://host.docker.internal:11434`.
3. Pull the model to Ollama using the following command.
```console
$ ollama pull llama2
```
{{< /tab >}}
{{< tab name="Use OpenAI" >}}
> [!IMPORTANT]
>
> Using OpenAI requires an [OpenAI account](https://platform.openai.com/login). OpenAI is a third-party hosted service and charges may apply.
1. Update the `LLM` value in your `.env` file to
`gpt-3.5`.
2. Uncomment and update the `OPENAI_API_KEY` value in your `.env` file to
your [OpenAI API key](https://help.openai.com/en/articles/4936850-where-do-i-find-my-api-key).
{{< /tab >}}
{{< /tabs >}}
### Run your GenAI application
At this point, you have the following services in your Compose file:
- Server service for your main GenAI application
- Database service to store vectors in a Neo4j database
- (optional) Ollama service to run the LLM
- (optional) Ollama-pull service to automatically pull the model for the Ollama
service
To run all the services, run the following command in your `docker-genai-sample`
directory:
```console
$ docker compose up --build
```
If your Compose file has the ollama-pull service, it may take several minutes for the ollama-pull service to pull the model. The ollama-pull service will continuously update the console with its status. After pulling the model, the ollama-pull service container will stop and you can access the application.
Once the application is running, open a browser and access the application at [http://localhost:8000](http://localhost:8000).
Upload a PDF file, for example the [Docker CLI Cheat Sheet](https://docs.docker.com/get-started/docker_cheatsheet.pdf), and ask a question about the PDF.
Depending on your system and the LLM service that you chose, it may take several
minutes to answer. If you are using Ollama and the performance isn't
acceptable, try using OpenAI.
### Summary
In this section, you learned how to set up a development environment to provide
access all the services that your GenAI application needs.
Related information:
- [Dockerfile reference](../../../reference/dockerfile.md)
- [Compose file reference](/reference/compose-file/_index.md)
- [Ollama Docker image](https://hub.docker.com/r/ollama/ollama)
- [Neo4j Official Docker Image](https://hub.docker.com/_/neo4j)
- [GenAI Stack demo applications](https://github.com/docker/genai-stack)
### Next steps
See samples of more GenAI applications in the [GenAI Stack demo applications](https://github.com/docker/genai-stack).
File diff suppressed because it is too large. Load diff
-282
View File
@@ -1,282 +0,0 @@
---
description: Containerize RAG application using Ollama and Docker
keywords: python, generative ai, genai, llm, ollama, rag, qdrant
title: Build a RAG application using Ollama and Docker
linkTitle: RAG Ollama application
summary: |
This guide demonstrates how to use Docker to deploy Retrieval-Augmented
Generation (RAG) models with Ollama.
aliases:
- /guides/use-case/rag-ollama/
- /guides/rag-ollama/containerize/
- /guides/rag-ollama/develop/
params:
tags: [ai]
time: 20 minutes
---
The Retrieval Augmented Generation (RAG) guide teaches you how to containerize an existing RAG application using Docker. The example application is a RAG that acts like a sommelier, giving you the best pairings between wines and food. In this guide, you’ll learn how to:
- Containerize and run a RAG application
- Set up a local environment to run the complete RAG stack locally for development
Start by containerizing an existing RAG application.
## Containerize a RAG application
### Overview
This section walks you through containerizing a RAG application using Docker.
> [!NOTE]
> You can see more samples of containerized GenAI applications in the [GenAI Stack](https://github.com/docker/genai-stack) demo applications.
### Get the sample application
The sample application used in this guide is an example of RAG application, made by three main components, which are the building blocks for every RAG application. A Large Language Model hosted somewhere, in this case it is hosted in a container and served via [Ollama](https://ollama.ai/). A vector database, [Qdrant](https://qdrant.tech/), to store the embeddings of local data, and a web application, using [Streamlit](https://streamlit.io/) to offer the best user experience to the user.
Clone the sample application. Open a terminal, change directory to a directory that you want to work in, and run the following command to clone the repository:
```console
$ git clone https://github.com/mfranzon/winy.git
```
You should now have the following files in your `winy` directory.
```text
├── winy/
│ ├── .gitignore
│ ├── app/
│ │ ├── main.py
│ │ ├── Dockerfile
| | └── requirements.txt
│ ├── tools/
│ │ ├── create_db.py
│ │ ├── create_embeddings.py
│ │ ├── requirements.txt
│ │ ├── test.py
| | └── download_model.sh
│ ├── docker-compose.yaml
│ ├── wine_database.db
│ ├── LICENSE
│ └── README.md
```
### Containerizing your application: Essentials
Containerizing an application involves packaging it along with its dependencies into a container, which ensures consistency across different environments. Here’s what you need to containerize an app like Winy :
1. Dockerfile: A Dockerfile that contains instructions on how to build a Docker image for your application. It specifies the base image, dependencies, configuration files, and the command to run your application.
2. Docker Compose File: Docker Compose is a tool for defining and running multi-container Docker applications. A Compose file allows you to configure your application's services, networks, and volumes in a single file.
### Run the application
Inside the `winy` directory, run the following command in a
terminal.
```console
$ docker compose up --build
```
Docker builds and runs your application. Depending on your network connection, it may take several minutes to download all the dependencies. You'll see a message like the following in the terminal when the application is running.
```console
server-1 | You can now view your Streamlit app in your browser.
server-1 |
server-1 | URL: http://0.0.0.0:8501
server-1 |
```
Open a browser and view the application at [http://localhost:8501](http://localhost:8501). You should see a simple Streamlit application.
The application requires a Qdrant database service and an LLM service to work properly. If you have access to services that you ran outside of Docker, specify the connection information in the `docker-compose.yaml`.
```yaml
winy:
build:
context: ./app
dockerfile: Dockerfile
environment:
- QDRANT_CLIENT=http://qdrant:6333 # Specifies the url for the qdrant database
- OLLAMA=http://ollama:11434 # Specifies the url for the ollama service
container_name: winy
ports:
- "8501:8501"
depends_on:
- qdrant
- ollama
```
If you don't have the services running, continue with this guide to learn how you can run some or all of these services with Docker.
Remember that the `ollama` service is empty; it doesn't have any model. For this reason you need to pull a model before starting to use the RAG application. All the instructions are in the following page.
In the terminal, press `ctrl`+`c` to stop the application.
### Summary
In this section, you learned how you can containerize and run your RAG
application using Docker.
### Next steps
In the next section, you'll learn how to properly configure the application with your preferred LLM model, completely locally, using Docker.
## Use containers for RAG development
### Prerequisites
Complete [Containerize a RAG application](#containerize-a-rag-application).
### Overview
In this section, you'll learn how to set up a development environment to access all the services that your generative RAG application needs. This includes:
- Adding a local database
- Adding a local or remote LLM service
> [!NOTE]
> You can see more samples of containerized GenAI applications in the [GenAI Stack](https://github.com/docker/genai-stack) demo applications.
### Add a local database
You can use containers to set up local services, like a database. In this section, you'll explore the database service in the `docker-compose.yaml` file.
To run the database service:
1. In the cloned repository's directory, open the `docker-compose.yaml` file in an IDE or text editor.
2. In the `docker-compose.yaml` file, you'll see the following:
```yaml
services:
qdrant:
image: qdrant/qdrant
container_name: qdrant
ports:
- "6333:6333"
volumes:
- qdrant_data:/qdrant/storage
```
> [!NOTE]
> To learn more about Qdrant, see the [Qdrant Official Docker Image](https://hub.docker.com/r/qdrant/qdrant).
3. Start the application. Inside the `winy` directory, run the following command in a terminal.
```console
$ docker compose up --build
```
4. Access the application. Open a browser and view the application at [http://localhost:8501](http://localhost:8501). You should see a simple Streamlit application.
5. Stop the application. In the terminal, press `ctrl`+`c` to stop the application.
### Add a local or remote LLM service
The sample application supports both [Ollama](https://ollama.ai/). This guide provides instructions for the following scenarios:
- Run Ollama in a container
- Run Ollama outside of a container
While all platforms can use any of the previous scenarios, the performance and
GPU support may vary. You can use the following guidelines to help you choose the appropriate option:
- Run Ollama in a container if you're on Linux, and using a native installation of the Docker Engine, or Windows 10/11, and using Docker Desktop, you
have a CUDA-supported GPU, and your system has at least 8 GB of RAM.
- Run Ollama outside of a container if running Docker Desktop on a Linux Machine.
Choose one of the following options for your LLM service.
{{< tabs >}}
{{< tab name="Run Ollama in a container" >}}
When running Ollama in a container, you should have a CUDA-supported GPU. While you can run Ollama in a container without a supported GPU, the performance may not be acceptable. Only Linux and Windows 11 support GPU access to containers.
To run Ollama in a container and provide GPU access:
1. Install the prerequisites.
- For Docker Engine on Linux, install the [NVIDIA Container Toolkilt](https://github.com/NVIDIA/nvidia-container-toolkit).
- For Docker Desktop on Windows 10/11, install the latest [NVIDIA driver](https://www.nvidia.com/Download/index.aspx) and make sure you are using the [WSL2 backend](/manuals/desktop/features/wsl/_index.md#turn-on-docker-desktop-wsl-2)
2. The `docker-compose.yaml` file already contains the necessary instructions. In your own apps, you'll need to add the Ollama service in your `docker-compose.yaml`. The following is
the updated `docker-compose.yaml`:
```yaml
ollama:
image: ollama/ollama
container_name: ollama
ports:
- "8000:8000"
deploy:
resources:
reservations:
devices:
- driver: nvidia
count: 1
capabilities: [gpu]
```
> [!NOTE]
> For more details about the Compose instructions, see [Turn on GPU access with Docker Compose](/manuals/compose/how-tos/gpu-support.md).
3. Once the Ollama container is up and running it is possible to use the `download_model.sh` inside the `tools` folder with this command:
```console
. ./download_model.sh <model-name>
```
Pulling an Ollama model can take several minutes.
{{< /tab >}}
{{< tab name="Run Ollama outside of a container" >}}
To run Ollama outside of a container:
1. [Install](https://github.com/jmorganca/ollama) and run Ollama on your host
machine.
2. Pull the model to Ollama using the following command.
```console
$ ollama pull llama2
```
3. Remove the `ollama` service from the `docker-compose.yaml` and update properly the connection variables in `winy` service:
```diff
- OLLAMA=http://ollama:11434
+ OLLAMA=<your-url>
```
{{< /tab >}}
{{< /tabs >}}
### Run your RAG application
At this point, you have the following services in your Compose file:
- Server service for your main RAG application
- Database service to store vectors in a Qdrant database
- (optional) Ollama service to run the LLM
service
Once the application is running, open a browser and access the application at [http://localhost:8501](http://localhost:8501).
Depending on your system and the LLM service that you chose, it may take several
minutes to answer.
### Summary
In this section, you learned how to set up a development environment to provide
access all the services that your GenAI application needs.
Related information:
- [Dockerfile reference](/reference/dockerfile.md)
- [Compose file reference](/reference/compose-file/_index.md)
- [Ollama Docker image](https://hub.docker.com/r/ollama/ollama)
- [GenAI Stack demo applications](https://github.com/docker/genai-stack)
### Next steps
See samples of more GenAI applications in the [GenAI Stack demo applications](https://github.com/docker/genai-stack).
@@ -39,10 +39,6 @@ grid:
description: Common questions about MCP security, credentials, and server verification description: Common questions about MCP security, credentials, and server verification
icon: shield-check icon: shield-check
link: /ai/mcp-catalog-and-toolkit/faqs/ link: /ai/mcp-catalog-and-toolkit/faqs/
- title: E2B sandboxes
description: Cloud sandboxes for AI agents with built-in MCP Catalog access
icon: cloud
link: /ai/mcp-catalog-and-toolkit/e2b-sandboxes/
--- ---
{{< summary-bar feature_name="Docker MCP Catalog and Toolkit" >}} {{< summary-bar feature_name="Docker MCP Catalog and Toolkit" >}}
@@ -19,11 +19,6 @@ to your [profiles](/manuals/desktop/features/mcp-catalog-and-toolkit/profiles.md
them from the catalog. Each server runs as an isolated container, making it them from the catalog. Each server runs as an isolated container, making it
portable and consistent across different environments. portable and consistent across different environments.
> [!NOTE]
> E2B sandboxes now include direct access to the Docker MCP Catalog, giving
> developers access to over 200 tools and services to seamlessly build and run
> AI agents. For more information, see [E2B Sandboxes](e2b-sandboxes.md).
## What's in the catalog ## What's in the catalog
The Docker MCP Catalog includes: The Docker MCP Catalog includes:
@@ -1,453 +0,0 @@
---
url: /ai/mcp-catalog-and-toolkit/e2b-sandboxes/
title: E2B sandboxes
description: Cloud-based secure sandboxes for AI agents with built-in Docker MCP Gateway integration
keywords: E2B, cloud sandboxes, MCP Gateway, AI agents, MCP Catalog
aliases:
- /ai/mcp-catalog-and-toolkit/sandboxes/
---
[E2B](https://e2b.dev/) provides secure cloud sandboxes for AI agents with direct access to Docker's [MCP Catalog](https://hub.docker.com/mcp), a collection of 200+ tools from publishers including GitHub, Notion, and Stripe.
When you create an E2B sandbox, you specify which MCP tools it should access. E2B launches these tools and provides access through the Docker MCP Gateway.
## Example: Using GitHub and Notion MCP server
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.
### Prerequisites
Before you begin, make sure you have the following:
- [E2B account](https://e2b.dev/docs/quickstart) with API access
- Anthropic API key for Claude
> [!NOTE]
> This example uses Claude Code, which is pre-installed in E2B sandboxes.
> However, you can adapt the example to work with other AI assistants of your
> choice. See [E2B's MCP documentation](https://e2b.dev/docs/mcp/quickstart)
> for alternative connection methods.
- Node.js 18+ installed on your machine
- Notion account with:
- A database containing sample data
- [Integration token](https://www.notion.com/help/add-and-manage-connections-with-the-api)
- GitHub account with:
- A repository for testing
- Personal access token with `repo` scope
### Set up your environment
Create a new directory and initialize a Node.js project:
```console
$ mkdir mcp-e2b-quickstart
$ cd mcp-e2b-quickstart
$ npm init -y
```
Configure your project for ES modules by updating `package.json`:
```json
{
"name": "mcp-e2b-quickstart",
"version": "1.0.0",
"type": "module",
"scripts": {
"start": "node index.js"
}
}
```
Install required dependencies:
```console
$ npm install e2b dotenv
```
Create a `.env` file with your credentials:
```console
$ cat > .env << 'EOF'
E2B_API_KEY=your_e2b_api_key_here
ANTHROPIC_API_KEY=your_anthropic_api_key_here
NOTION_INTEGRATION_TOKEN=ntn_your_notion_integration_token_here
GITHUB_TOKEN=ghp_your_github_pat_here
EOF
```
Protect your credentials:
```console
$ echo ".env" >> .gitignore
$ echo "node_modules/" >> .gitignore
```
### Create an E2B sandbox with MCP servers
{{< tabs group="" >}}
{{< tab name="Typescript">}}
Create a file named `index.ts`:
```typescript
import "dotenv/config";
import { Sandbox } from "e2b";
async function quickstart(): Promise<void> {
console.log("Creating E2B sandbox with Notion and GitHub MCP servers...\n");
const sbx: Sandbox = await Sandbox.create({
envs: {
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY as string,
},
mcp: {
notion: {
internalIntegrationToken: process.env
.NOTION_INTEGRATION_TOKEN as string,
},
githubOfficial: {
githubPersonalAccessToken: process.env.GITHUB_TOKEN as string,
},
},
});
const mcpUrl = sbx.getMcpUrl();
const mcpToken = await sbx.getMcpToken();
console.log("Sandbox created successfully!");
console.log(`MCP Gateway URL: ${mcpUrl}\n`);
// Wait for MCP initialization
await new Promise<void>((resolve) => setTimeout(resolve, 1000));
// Connect Claude to MCP gateway
console.log("Connecting Claude to MCP gateway...");
await sbx.commands.run(
`claude mcp add --transport http e2b-mcp-gateway ${mcpUrl} --header "Authorization: Bearer ${mcpToken}"`,
{
timeoutMs: 0,
onStdout: console.log,
onStderr: console.log,
},
);
console.log("\nConnection successful! Cleaning up...");
await sbx.kill();
}
quickstart().catch(console.error);
```
Run the script:
```console
$ npx tsx index.ts
```
{{< /tab >}}
{{< tab name="Python">}}
Create a file named `index.py`:
```python
import os
import asyncio
from dotenv import load_dotenv
from e2b import Sandbox
load_dotenv()
async def quickstart():
print("Creating E2B sandbox with Notion and GitHub MCP servers...\n")
sbx = await Sandbox.beta_create(
envs={
"ANTHROPIC_API_KEY": os.getenv("ANTHROPIC_API_KEY"),
},
mcp={
"notion": {
"internalIntegrationToken": os.getenv("NOTION_INTEGRATION_TOKEN"),
},
"githubOfficial": {
"githubPersonalAccessToken": os.getenv("GITHUB_TOKEN"),
},
},
)
mcp_url = sbx.beta_get_mcp_url()
mcp_token = await sbx.beta_get_mcp_token()
print("Sandbox created successfully!")
print(f"MCP Gateway URL: {mcp_url}\n")
# Wait for MCP initialization
await asyncio.sleep(1)
# Connect Claude to MCP gateway
print("Connecting Claude to MCP gateway...")
def on_stdout(output):
print(output, end='')
def on_stderr(output):
print(output, end='')
await sbx.commands.run(
f'claude mcp add --transport http e2b-mcp-gateway {mcp_url} --header "Authorization: Bearer {mcp_token}"',
timeout_ms=0,
on_stdout=on_stdout,
on_stderr=on_stderr
)
print("\nConnection successful! Cleaning up...")
await sbx.kill()
if __name__ == "__main__":
try:
asyncio.run(quickstart())
except Exception as e:
print(f"Error: {e}")
```
Run the script:
```console
$ python index.py
```
{{< /tab >}}
{{</tabs >}}
You should see:
```console
Creating E2B sandbox with Notion and GitHub MCP servers...
Sandbox created successfully!
MCP Gateway URL: https://50005-xxxxx.e2b.app/mcp
Connecting Claude to MCP gateway...
Added HTTP MCP server e2b-mcp-gateway with URL: https://50005-xxxxx.e2b.app/mcp
Connection successful! Cleaning up...
```
### Test with example workflow
Now, test the setup by running a simple workflow that searches Notion and creates a GitHub issue.
{{< tabs group="" >}}
{{< tab name="Typescript">}}
> [!IMPORTANT]
>
> Replace `owner/repo` in the prompt with your actual GitHub username and repository
> name (for example, `yourname/test-repo`).
Update `index.ts` with the following example:
```typescript
import "dotenv/config";
import { Sandbox } from "e2b";
async function exampleWorkflow(): Promise<void> {
console.log("Creating sandbox...\n");
const sbx: Sandbox = await Sandbox.create({
envs: {
ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY as string,
},
mcp: {
notion: {
internalIntegrationToken: process.env
.NOTION_INTEGRATION_TOKEN as string,
},
githubOfficial: {
githubPersonalAccessToken: process.env.GITHUB_TOKEN as string,
},
},
});
const mcpUrl = sbx.getMcpUrl();
const mcpToken = await sbx.getMcpToken();
console.log("Sandbox created successfully\n");
// Wait for MCP servers to initialize
await new Promise<void>((resolve) => setTimeout(resolve, 3000));
console.log("Connecting Claude to MCP gateway...\n");
await sbx.commands.run(
`claude mcp add --transport http e2b-mcp-gateway ${mcpUrl} --header "Authorization: Bearer ${mcpToken}"`,
{
timeoutMs: 0,
onStdout: console.log,
onStderr: console.log,
},
);
console.log("\nRunning example: Search Notion and create GitHub issue...\n");
const prompt: string = `Using Notion and GitHub MCP tools:
1. Search my Notion workspace for databases
2. Create a test issue in owner/repo titled "MCP Toolkit Test" with description "Testing E2B + Docker MCP integration"
3. Confirm both operations completed successfully`;
await sbx.commands.run(
`echo '${prompt.replace(/'/g, "'\\''")}' | claude -p --dangerously-skip-permissions`,
{
timeoutMs: 0,
onStdout: console.log,
onStderr: console.log,
},
);
await sbx.kill();
}
exampleWorkflow().catch(console.error);
```
Run the script:
```console
$ npx tsx index.ts
```
{{< /tab >}}
{{< tab name="Python">}}
Update `index.py` with this example:
> [!IMPORTANT]
>
> Replace `owner/repo` in the prompt with your actual GitHub username and repository
> name (for example, `yourname/test-repo`).
```python
import os
import asyncio
import shlex
from dotenv import load_dotenv
from e2b import Sandbox
load_dotenv()
async def example_workflow():
print("Creating sandbox...\n")
sbx = await Sandbox.beta_create(
envs={
"ANTHROPIC_API_KEY": os.getenv("ANTHROPIC_API_KEY"),
},
mcp={
"notion": {
"internalIntegrationToken": os.getenv("NOTION_INTEGRATION_TOKEN"),
},
"githubOfficial": {
"githubPersonalAccessToken": os.getenv("GITHUB_TOKEN"),
},
},
)
mcp_url = sbx.beta_get_mcp_url()
mcp_token = await sbx.beta_get_mcp_token()
print("Sandbox created successfully\n")
# Wait for MCP servers to initialize
await asyncio.sleep(3)
print("Connecting Claude to MCP gateway...\n")
def on_stdout(output):
print(output, end='')
def on_stderr(output):
print(output, end='')
await sbx.commands.run(
f'claude mcp add --transport http e2b-mcp-gateway {mcp_url} --header "Authorization: Bearer {mcp_token}"',
timeout_ms=0,
on_stdout=on_stdout,
on_stderr=on_stderr
)
print("\nRunning example: Search Notion and create GitHub issue...\n")
prompt = """Using Notion and GitHub MCP tools:
1. Search my Notion workspace for databases
2. Create a test issue in owner/repo titled "MCP Toolkit Test" with description "Testing E2B + Docker MCP integration"
3. Confirm both operations completed successfully"""
# Escape single quotes for shell
escaped_prompt = prompt.replace("'", "'\\''")
await sbx.commands.run(
f"echo '{escaped_prompt}' | claude -p --dangerously-skip-permissions",
timeout_ms=0,
on_stdout=on_stdout,
on_stderr=on_stderr
)
await sbx.kill()
if __name__ == "__main__":
try:
asyncio.run(example_workflow())
except Exception as e:
print(f"Error: {e}")
```
Run the script:
```console
$ python workflow.py
```
{{< /tab >}}
{{</tabs >}}
You should see:
```console
Creating sandbox...
Running example: Search Notion and create GitHub issue...
## Task Completed Successfully
I've completed both operations using the Notion and GitHub MCP tools:
### 1. Notion Workspace Search
Found 3 databases in your Notion workspace:
- **Customer Feedback** - Database with 12 entries tracking feature requests
- **Product Roadmap** - Planning database with 8 active projects
- **Meeting Notes** - Shared workspace with 45 pages
### 2. GitHub Issue Creation
Successfully created test issue:
- **Repository**: your-org/your-repo
- **Issue Number**: #47
- **Title**: "MCP Test"
- **Description**: "Testing E2B + Docker MCP integration"
- **Status**: Open
- **URL**: https://github.com/your-org/your-repo/issues/47
Both operations completed successfully. The MCP servers are properly configured and working.
```
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.
## Related pages
- [How to build an AI-powered code quality workflow with SonarQube and E2B](/guides/github-sonarqube-sandbox.md)
- [Docker + E2B: Building the Future of Trusted AI](https://www.docker.com/blog/docker-e2b-building-the-future-of-trusted-ai/)
- [Docker Sandboxes](/manuals/ai/sandboxes/_index.md)
- [Docker MCP Toolkit and Catalog](/manuals/desktop/features/mcp-catalog-and-toolkit/_index.md)
- [Docker MCP Gateway](/manuals/desktop/features/mcp-catalog-and-toolkit/mcp-gateway.md)
- [E2B MCP documentation](https://e2b.dev/docs/mcp)
@@ -26,11 +26,6 @@ If you use Docker Desktop with MCP Toolkit enabled, the Gateway runs
automatically in the background. You don't need to start or configure it automatically in the background. You don't need to start or configure it
manually. This documentation is for users who want to understand how the Gateway works or run it directly for advanced use cases. manually. This documentation is for users who want to understand how the Gateway works or run it directly for advanced use cases.
> [!TIP]
> E2B sandboxes now include direct access to the Docker MCP Catalog, giving developers
> access to over 200 tools and services to seamlessly build and run AI agents. For
> more information, see [E2B Sandboxes](e2b-sandboxes.md).
## How it works ## How it works
MCP Gateway runs MCP servers in isolated Docker containers with restricted MCP Gateway runs MCP servers in isolated Docker containers with restricted
+15
View File
@@ -404,6 +404,21 @@
# Desktop DMR # Desktop DMR
"/ai/model-runner/": "/ai/model-runner/":
- /go/model-runner/ - /go/model-runner/
- /guides/genai-pdf-bot/
- /guides/use-case/genai-pdf-bot/
- /guides/genai-pdf-bot/containerize/
- /guides/genai-pdf-bot/develop/
- /guides/rag-ollama/
- /guides/use-case/rag-ollama/
- /guides/rag-ollama/containerize/
- /guides/rag-ollama/develop/
"/ai/sandboxes/":
- /guides/github-sonarqube-sandbox/
- /guides/github-sonarqube-sandbox/customize/
- /guides/github-sonarqube-sandbox/troubleshoot/
- /guides/github-sonarqube-sandbox/workflow/
- /ai/mcp-catalog-and-toolkit/e2b-sandboxes/
- /ai/mcp-catalog-and-toolkit/sandboxes/
# Docker Desktop - volumes cloud backup # Docker Desktop - volumes cloud backup
"/desktop/use-desktop/volumes/#export-a-volume": "/desktop/use-desktop/volumes/#export-a-volume":