Skip to content

🙌 OpenHands: AI-Driven Development

docs: Update custom sandbox guide to include steps to use pre-existin… (#2740)

r.e.e.c.h.e.e94d68ca0b891
diff --git a/docs/modules/usage/custom_sandbox_guide.md b/docs/modules/usage/custom_sandbox_guide.md
index d481babc44..9101c08f0a 100644
--- a/docs/modules/usage/custom_sandbox_guide.md
+++ b/docs/modules/usage/custom_sandbox_guide.md
@@ -1,27 +1,38 @@
# 💿 How to Create a Custom Docker Sandbox
-The default OpenDevin sandbox comes with a [minimal ubuntu configuration](https://github.com/OpenDevin/OpenDevin/blob/main/containers/sandbox/Dockerfile). Your use case may need additional software installed by default. This guide will teach you how to accomplish this by utilizing a custom docker image.
+The default OpenDevin sandbox comes with a [minimal ubuntu configuration](https://github.com/OpenDevin/OpenDevin/blob/main/containers/sandbox/Dockerfile).
+
+Your use case may need additional software installed by default.
+
+There are two ways you can do so:
+1. Use an existing image from docker hub. For instance, if you want to have `nodejs` installed, you can do so by using the `node:21` image.
+2. Creating your own custom docker image.
+
+If you want to take the first approach, you can skip the next section.
## Setup
Make sure you are able to run OpenDevin using the [Development.md](https://github.com/OpenDevin/OpenDevin/blob/main/Development.md) first.
## Create Your Docker Image
+To create a custom docker image, it must be debian/ubuntu based.
-Next you must create your custom docker image, which should be debian/ubuntu based. For example if we want want OpenDevin to have access to the "node" binary, we would use the following Dockerfile:
+For example, if we want OpenDevin to have access to the "node" binary, we would use the following Dockerfile:
-```bash
+```dockerfile
# Start with latest ubuntu image
FROM ubuntu:latest
# Run needed updates
-RUN apt-get update && apt-get install
+RUN apt-get update && apt-get install -y
# Install node
RUN apt-get install -y nodejs
```
-Next build your docker image with the name of your choice, for example "custom_image". To do this you can create a directory and put your file inside it with the name "Dockerfile", and inside the directory run the following command:
+Next build your docker image with the name of your choice, for example "custom_image".
+
+To do this you can create a directory and put your file inside it with the name "Dockerfile", and inside the directory run the following command:
```bash
docker build -t custom_image .
@@ -33,11 +44,11 @@ This will produce a new image called ```custom_image``` that will be available i
>
> Installing with apt-get above installs node for all users.
+## Specify your sandbox image in config.toml file
-## Specify your custom image in config.toml file
+OpenDevin configuration occurs via the top-level `config.toml` file.
-OpenDevin configuration occurs via the top level ```config.toml``` file.
-Create a ```config.toml``` file in the OpenDevin directory and enter these contents:
+Create a `config.toml` file in the OpenDevin directory and enter these contents:
```toml
[core]
@@ -46,7 +57,10 @@ persist_sandbox=false
run_as_devin=true
sandbox_container_image="custom_image"
```
-> Ensure that sandbox_container_image is set to the name of your custom image from the previous step.
+
+For sandbox_container_image, you can specify either:
+1. The name of your custom image that you built in the previous step (e.g., "custom_image")
+2. A pre-existing image from Docker Hub (e.g., "node:21" if you want a sandbox with Node.js pre-installed)
## Run
Run OpenDevin by running ```make run``` in the top level directory.