mirror of
https://github.com/OpenHands/OpenHands.git
synced 2026-03-22 13:47:19 +08:00
docs: Update custom sandbox guide to include steps to use pre-existin… (#2740)
* docs: Update custom sandbox guide to include steps to use pre-existing Docker images #2734 * docs: Update custom and pre-existing sandbox guide * docs: Update custom and pre-existing sandbox guide
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user