Skip to content

Commit 94d68ca

Browse files
docs: Update custom sandbox guide to include steps to use pre-existin… (OpenHands#2740)
* docs: Update custom sandbox guide to include steps to use pre-existing Docker images OpenHands#2734 * docs: Update custom and pre-existing sandbox guide * docs: Update custom and pre-existing sandbox guide
1 parent 4dc01a7 commit 94d68ca

1 file changed

Lines changed: 23 additions & 9 deletions

File tree

docs/modules/usage/custom_sandbox_guide.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,38 @@
11
# 💿 How to Create a Custom Docker Sandbox
22

3-
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.
3+
The default OpenDevin sandbox comes with a [minimal ubuntu configuration](https://github.com/OpenDevin/OpenDevin/blob/main/containers/sandbox/Dockerfile).
4+
5+
Your use case may need additional software installed by default.
6+
7+
There are two ways you can do so:
8+
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.
9+
2. Creating your own custom docker image.
10+
11+
If you want to take the first approach, you can skip the next section.
412

513
## Setup
614

715
Make sure you are able to run OpenDevin using the [Development.md](https://github.com/OpenDevin/OpenDevin/blob/main/Development.md) first.
816

917
## Create Your Docker Image
18+
To create a custom docker image, it must be debian/ubuntu based.
1019

11-
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:
20+
For example, if we want OpenDevin to have access to the "node" binary, we would use the following Dockerfile:
1221

13-
```bash
22+
```dockerfile
1423
# Start with latest ubuntu image
1524
FROM ubuntu:latest
1625

1726
# Run needed updates
18-
RUN apt-get update && apt-get install
27+
RUN apt-get update && apt-get install -y
1928

2029
# Install node
2130
RUN apt-get install -y nodejs
2231
```
2332

24-
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:
33+
Next build your docker image with the name of your choice, for example "custom_image".
34+
35+
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:
2536

2637
```bash
2738
docker build -t custom_image .
@@ -33,11 +44,11 @@ This will produce a new image called ```custom_image``` that will be available i
3344
>
3445
> Installing with apt-get above installs node for all users.
3546
47+
## Specify your sandbox image in config.toml file
3648

37-
## Specify your custom image in config.toml file
49+
OpenDevin configuration occurs via the top-level `config.toml` file.
3850

39-
OpenDevin configuration occurs via the top level ```config.toml``` file.
40-
Create a ```config.toml``` file in the OpenDevin directory and enter these contents:
51+
Create a `config.toml` file in the OpenDevin directory and enter these contents:
4152

4253
```toml
4354
[core]
@@ -46,7 +57,10 @@ persist_sandbox=false
4657
run_as_devin=true
4758
sandbox_container_image="custom_image"
4859
```
49-
> Ensure that sandbox_container_image is set to the name of your custom image from the previous step.
60+
61+
For sandbox_container_image, you can specify either:
62+
1. The name of your custom image that you built in the previous step (e.g., "custom_image")
63+
2. A pre-existing image from Docker Hub (e.g., "node:21" if you want a sandbox with Node.js pre-installed)
5064

5165
## Run
5266
Run OpenDevin by running ```make run``` in the top level directory.

0 commit comments

Comments
 (0)