Skip to content

Commit 0973e31

Browse files
authored
Update custom sandbox usage guide (OpenHands#2829)
1 parent 82f256b commit 0973e31

1 file changed

Lines changed: 18 additions & 13 deletions

File tree

docs/modules/usage/custom_sandbox_guide.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ The default OpenDevin sandbox comes with a [minimal ubuntu configuration](https:
55
Your use case may need additional software installed by default.
66

77
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.
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:20` image.
99
2. Creating your own custom docker image.
1010

1111
If you want to take the first approach, you can skip the next section.
@@ -60,14 +60,14 @@ sandbox_container_image="custom_image"
6060

6161
For sandbox_container_image, you can specify either:
6262
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)
63+
2. A pre-existing image from Docker Hub (e.g., "node:20" if you want a sandbox with Node.js pre-installed)
6464

6565
## Run
6666
Run OpenDevin by running ```make run``` in the top level directory.
6767

6868
Navigate to ```localhost:3001``` and check if your desired dependencies are available.
6969

70-
In the case of the example above, running ```node -v``` in the terminal produces ```v18.19.1```
70+
In the case of the example above, running ```node -v``` in the terminal produces ```v20.15.0```
7171

7272
Congratulations!
7373

@@ -83,16 +83,21 @@ The custom image is built using [_build_sandbox_image()](https://github.com/Open
8383

8484
```python
8585
dockerfile_content = (
86-
f'FROM {base_image}\n'
87-
'RUN apt update && apt install -y openssh-server wget sudo\n'
88-
'RUN mkdir -p -m0755 /var/run/sshd\n'
89-
'RUN mkdir -p /opendevin && mkdir -p /opendevin/logs && chmod 777 /opendevin/logs\n'
90-
'RUN wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh"\n'
91-
'RUN bash Miniforge3-$(uname)-$(uname -m).sh -b -p /opendevin/miniforge3\n'
92-
'RUN bash -c ". /opendevin/miniforge3/etc/profile.d/conda.sh && conda config --set changeps1 False && conda config --append channels conda-forge"\n'
93-
'RUN echo "export PATH=/opendevin/miniforge3/bin:$PATH" >> ~/.bashrc\n'
94-
'RUN echo "export PATH=/opendevin/miniforge3/bin:$PATH" >> /opendevin/bash.bashrc\n'
95-
).strip()
86+
f'FROM {base_image}\n'
87+
'RUN apt update && apt install -y openssh-server wget sudo\n'
88+
'RUN mkdir -p -m0755 /var/run/sshd\n'
89+
'RUN mkdir -p /opendevin && mkdir -p /opendevin/logs && chmod 777 /opendevin/logs\n'
90+
'RUN echo "" > /opendevin/bash.bashrc\n'
91+
'RUN if [ ! -d /opendevin/miniforge3 ]; then \\\n'
92+
' wget "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-$(uname)-$(uname -m).sh" && \\\n'
93+
' bash Miniforge3-$(uname)-$(uname -m).sh -b -p /opendevin/miniforge3 && \\\n'
94+
' chmod -R g+w /opendevin/miniforge3 && \\\n'
95+
' bash -c ". /opendevin/miniforge3/etc/profile.d/conda.sh && conda config --set changeps1 False && conda config --append channels conda-forge"; \\\n'
96+
' fi\n'
97+
'RUN /opendevin/miniforge3/bin/pip install --upgrade pip\n'
98+
'RUN /opendevin/miniforge3/bin/pip install jupyterlab notebook jupyter_kernel_gateway flake8\n'
99+
'RUN /opendevin/miniforge3/bin/pip install python-docx PyPDF2 python-pptx pylatexenc openai\n'
100+
).strip()
96101
```
97102

98103
> Note: the name of the image is modified via [_get_new_image_name()](https://github.com/OpenDevin/OpenDevin/blob/main/opendevin/runtime/docker/image_agnostic_util.py#L63) and it is the modified name that is searched for on subsequent runs.

0 commit comments

Comments
 (0)