Open jriff opened 1 month ago
I have a similar problem. I used this guide here (https://docs.all-hands.dev/modules/usage/how-to/custom-sandbox-guide) to create an image.
Starting OpenHands with this image like this:
export WORKSPACE_BASE=$(pwd)/workspace
docker run -it --pull=never \
-e SANDBOX_RUNTIME_CONTAINER_IMAGE=custom-image \
-e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-v $WORKSPACE_BASE:/opt/workspace_base \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 3000:3000 \
--add-host host.docker.internal:host-gateway \
--name openhands-app-$(date +%Y%m%d%H%M%S) \
ghcr.io/all-hands-ai/openhands:0.9
leads to this error message:
Starting OpenHands...
Setting up enduser with id 501
Docker socket group id: 102
_ssh:x:102:
Group with id 102 already exists
Running as enduser
INFO: Started server process [36]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO: 172.17.0.1:55640 - "GET /api/options/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:55640 - "GET /api/options/agents HTTP/1.1" 200 OK
INFO: 172.17.0.1:55656 - "GET /favicon-32x32.png HTTP/1.1" 304 Not Modified
INFO: 172.17.0.1:55640 - "GET /api/options/security-analyzers HTTP/1.1" 200 OK
INFO: ('172.17.0.1', 55666) - "WebSocket /ws" [accepted]
INFO: connection open
07:02:08 - openhands:INFO: agent_session.py:182 - Initializing runtime `eventstream` now...
07:02:08 - openhands:INFO: runtime.py:216 - Preparing to start container...
07:02:09 - openhands:ERROR: runtime.py:299 - Error: Instance 533a7ff7-c7c4-4c47-8f51-12a32826ab7d_2537f8ff-3f87-4c48-b63a-d78232ef293e FAILED to start container!
07:02:09 - openhands:ERROR: runtime.py:302 - 400 Client Error for http+docker://localhost/v1.45/containers/c028d2d620fc4346ddbd53943a10269834eec76cb20fbc5553c464447653b3d2/start: Bad Request ("failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/openhands/micromamba/bin/micromamba": stat /openhands/micromamba/bin/micromamba: no such file or directory: unknown")
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 275, in _raise_for_status
response.raise_for_status()
File "/app/.venv/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http+docker://localhost/v1.45/containers/c028d2d620fc4346ddbd53943a10269834eec76cb20fbc5553c464447653b3d2/start
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/openhands/runtime/client/runtime.py", line 274, in _init_container
container = self.docker_client.containers.run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/docker/models/containers.py", line 883, in run
container.start()
File "/app/.venv/lib/python3.12/site-packages/docker/models/containers.py", line 420, in start
return self.client.api.start(self.id, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/docker/utils/decorators.py", line 19, in wrapped
return f(self, resource_id, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/docker/api/container.py", line 1136, in start
self._raise_for_status(res)
File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 277, in _raise_for_status
raise create_api_error_from_http_exception(e) from e
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/docker/errors.py", line 39, in create_api_error_from_http_exception
raise cls(e, response=response, explanation=explanation) from e
docker.errors.APIError: 400 Client Error for http+docker://localhost/v1.45/containers/c028d2d620fc4346ddbd53943a10269834eec76cb20fbc5553c464447653b3d2/start: Bad Request ("failed to create task for container: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "/openhands/micromamba/bin/micromamba": stat /openhands/micromamba/bin/micromamba: no such file or directory: unknown")
^C
Session terminated, killing shell...INFO: Shutting down
...killed.
@jriff a change was merged can you try with:
ghcr.io/all-hands-ai/openhands:main
and see if it works now please?
@goetz-markgraf, you need to set SANDBOX_BASE_CONTAINER_IMAGE
in this case not SANDBOX_RUNTIME_CONTAINER_IMAGE
. Please also use ghcr.io/all-hands-ai/openhands:main
for now until the next version is released.
I'm going to update the documentation and hopefully we can close this.
@mamoodi, thank you for your input. Unfortunately, it does not work. First, I did not find a tag main
. My docker could not download it:
docker: Error response from daemon: No such image: ghcr.io/all-hands-ai/openhands:main.
When I tried it with the Tag 0.9
, I got these error messages:
Starting OpenHands...
Setting up enduser with id 501
Docker socket group id: 102
_ssh:x:102:
Group with id 102 already exists
Running as enduser
INFO: Started server process [35]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit)
INFO: 172.17.0.1:52194 - "GET / HTTP/1.1" 304 Not Modified
INFO: 172.17.0.1:52194 - "GET /assets/index-C__Czp6D.js HTTP/1.1" 304 Not Modified
INFO: 172.17.0.1:52190 - "GET /assets/index-i6NoV3nb.css HTTP/1.1" 304 Not Modified
INFO: 172.17.0.1:52208 - "GET /assets/index-C__Czp6D.js HTTP/1.1" 304 Not Modified
INFO: 172.17.0.1:52190 - "GET /locales/en/translation.json HTTP/1.1" 304 Not Modified
INFO: 172.17.0.1:52190 - "GET /api/options/models HTTP/1.1" 200 OK
INFO: 172.17.0.1:52190 - "GET /api/options/agents HTTP/1.1" 200 OK
INFO: 172.17.0.1:52210 - "GET /site.webmanifest HTTP/1.1" 304 Not Modified
INFO: 172.17.0.1:52190 - "GET /api/options/security-analyzers HTTP/1.1" 200 OK
INFO: 172.17.0.1:52194 - "GET /favicon-32x32.png HTTP/1.1" 304 Not Modified
INFO: ('172.17.0.1', 52214) - "WebSocket /ws" [accepted]
INFO: connection open
06:52:37 - openhands:INFO: agent_session.py:182 - Initializing runtime `eventstream` now...
06:52:37 - openhands:INFO: runtime.py:164 - Preparing container, this might take a few minutes...
06:52:37 - openhands:INFO: runtime_build.py:33 - Building source distribution using project root: /app
06:52:40 - openhands:INFO: runtime_build.py:50 - * Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- poetry-core
* Getting build dependencies for sdist...
* Building sdist...
Successfully built openhands_ai-0.9.7.tar.gz
06:52:40 - openhands:INFO: runtime_build.py:62 - Source distribution created at /tmp/tmpa90e9x8i/openhands_ai-0.9.7.tar.gz
06:52:40 - openhands:INFO: runtime_build.py:73 - Unpacked source code directory: /tmp/tmpa90e9x8i/code
06:52:40 - openhands:INFO: runtime_build.py:154 - Input base image: custom-image
Skip init: False
Extra deps: None
Hash for docker build directory [/tmp/tmpa90e9x8i] (contents: ['Dockerfile', 'code']): v0.9.7_8eb12b33c9b8f65ccadde6a667d7b2ee
06:52:41 - openhands:INFO: runtime_build.py:33 - Building source distribution using project root: /app
06:52:43 - openhands:INFO: runtime_build.py:50 - * Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
- poetry-core
* Getting build dependencies for sdist...
* Building sdist...
Successfully built openhands_ai-0.9.7.tar.gz
06:52:43 - openhands:INFO: runtime_build.py:62 - Source distribution created at /tmp/tmp08cvou5e/openhands_ai-0.9.7.tar.gz
06:52:43 - openhands:INFO: runtime_build.py:73 - Unpacked source code directory: /tmp/tmp08cvou5e/code
06:52:43 - openhands:INFO: runtime_build.py:154 - Input base image: custom-image
Skip init: False
Extra deps: None
Hash for docker build directory [/tmp/tmp08cvou5e] (contents: ['Dockerfile', 'code']): v0.9.7_8eb12b33c9b8f65ccadde6a667d7b2ee
================ DOCKER BUILD STARTED ================
(several blank lines)
06:52:44 - openhands:ERROR: docker.py:130 - Python executable not found: [Errno 2] No such file or directory: 'docker'
06:52:44 - openhands:ERROR: runtime_build.py:383 - Sandbox image build failed: [Errno 2] No such file or directory: 'docker'
06:52:44 - openhands:ERROR: agent_session.py:194 - Runtime initialization failed: [Errno 2] No such file or directory: 'docker'
06:52:44 - openhands:ERROR: agent_session.py:84 - Error starting session: [Errno 2] No such file or directory: 'docker'
You have to use main
for now because we haven't released since the changes went into main. Can you try to pull the docker image directly first?
docker pull ghcr.io/all-hands-ai/openhands:main
Yes! It did seem to work 🥳 No errors and the server is starting up.
I am unable to test further, though. On :main, I've had this problem for several days:
I can't choose anything in the drop-downs. I just see "verified" and "others" but none of them are clickable. I don't know if this is a known issue. It happens both in Safari and Chrome on Mac.
That's very strange. You're running the docker command like in the README? Seems like the backend might not be running? Try opening an incognito window in Chrome or refreshing your cache on the browser. I just ran main and seems fine.
I'm running this command:
docker pull ghcr.io/rails/devcontainer/images/ruby:3.3.4
docker run -it --pull=always \
-e SANDBOX_BASE_CONTAINER_IMAGE=ruby:3.3.4 \
-e SANDBOX_USER_ID=$(id -u) \
-e WORKSPACE_MOUNT_PATH="$(pwd)" \
-v "$(pwd)":/opt/workspace_base \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 3001:3000 \
--add-host host.docker.internal:host-gateway \
--name openhands-app-$(date +%Y%m%d%H%M%S) \
ghcr.io/all-hands-ai/openhands:main
I have tried both incognito and also cleared my cache to no avail.
Huh I can reproduce if I give it the same ports as you. But this works:
-p 3000:3000
Maybe something is hardcoded somewhere now.
Ok. That makes sense. I have a Rails server running on port 3000 so I need to use another port for OpenHands.
Mind opening another issue when you have a few minutes for that please? And maybe I can get some eyes on it.
Will do that now.
Going to close this specific issue since it seems resolved. Thank you for opening the other issue. amanape seems aware.
I'm going to reopen this because the changes that were made broke a bunch of stuff related to actually starting OpenHands so it was reverted.
I'm trying to run the below docker command but it fails as seen below. I'd like to be able to a specify a custom image just as I would in the config.toml here: https://docs.all-hands.dev/modules/usage/how-to/custom-sandbox-guide
When I do, I get this error on startup: