All-Hands-AI / OpenHands

🙌 OpenHands: Code Less, Make More
https://all-hands.dev
MIT License
37.58k stars 4.25k forks source link

[Bug]: docker build error in build from source startup v0.12.3 #4848

Open tobitege opened 2 weeks ago

tobitege commented 2 weeks ago

Is there an existing issue for the same bug?

Describe the bug and reproduction steps

No local docker images, sources are as of right now, main branch, ran make build and make run (Ubuntu 23.04 in WSL). Opened webpage, entered "what poetry version is installed?" in hero page prompt and OH started image creation, but fails after couple of seconds:

20:48:54 - openhands:ERROR: agent_session.py:197 - Runtime initialization failed: Command '['docker', 'buildx', 'build', '--progress=plain', '--build-arg=OPENHANDS_RUNTIME_VERSION=0.12.3', '--build-arg=OPENHANDS_RUNTIME_BUILD_TIME=2024-11-08T20:48:42.303720', '--tag=ghcr.io/all-hands-ai/runtime:oh_v0.12.3_rzthzrruf4nl4ih5_n1ymk823ynfjmq8i', '--load', '/tmp/tmpgn3bmnwu']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/mnt/d/github/OpenDevin/openhands/server/session/agent_session.py", line 195, in _create_runtime
    await self.runtime.connect()
  File "/mnt/d/github/OpenDevin/openhands/runtime/impl/eventstream/eventstream_runtime.py", line 199, in connect
    self.runtime_container_image = build_runtime_image(
                                   ^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/openhands/runtime/utils/runtime_build.py", line 134, in build_runtime_image
    result = build_runtime_image_in_folder(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/openhands/runtime/utils/runtime_build.py", line 225, in build_runtime_image_in_folder
    _build_sandbox_image(
  File "/mnt/d/github/OpenDevin/openhands/runtime/utils/runtime_build.py", line 352, in _build_sandbox_image
    image_name = runtime_builder.build(
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/openhands/runtime/builder/docker.py", line 114, in build
    raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command '['docker', 'buildx', 'build', '--progress=plain', '--build-arg=OPENHANDS_RUNTIME_VERSION=0.12.3', '--build-arg=OPENHANDS_RUNTIME_BUILD_TIME=2024-11-08T20:48:42.303720', '--tag=ghcr.io/all-hands-ai/runtime:oh_v0.12.3_rzthzrruf4nl4ih5_n1ymk823ynfjmq8i', '--load', '/tmp/tmpgn3bmnwu']' returned non-zero exit status 1.
ERROR:asyncio:Future exception was never retrieved
future: <Future finished exception=CalledProcessError(1, ['docker', 'buildx', 'build', '--progress=plain', '--build-arg=OPENHANDS_RUNTIME_VERSION=0.12.3', '--build-arg=OPENHANDS_RUNTIME_BUILD_TIME=2024-11-08T20:48:42.303720', '--tag=ghcr.io/all-hands-ai/runtime:oh_v0.12.3_rzthzrruf4nl4ih5_n1ymk823ynfjmq8i', '--load', '/tmp/tmpgn3bmnwu'])>
Traceback (most recent call last):
  File "/usr/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/openhands/server/session/agent_session.py", line 92, in _start_thread
    asyncio.run(self._start(*args), debug=True)
  File "/usr/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "uvloop/loop.pyx", line 1517, in uvloop.loop.Loop.run_until_complete
  File "/mnt/d/github/OpenDevin/openhands/server/session/agent_session.py", line 108, in _start
    await self._create_runtime(
  File "/mnt/d/github/OpenDevin/openhands/server/session/agent_session.py", line 195, in _create_runtime
    await self.runtime.connect()
  File "/mnt/d/github/OpenDevin/openhands/runtime/impl/eventstream/eventstream_runtime.py", line 199, in connect
    self.runtime_container_image = build_runtime_image(
                                   ^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/openhands/runtime/utils/runtime_build.py", line 134, in build_runtime_image
    result = build_runtime_image_in_folder(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/openhands/runtime/utils/runtime_build.py", line 225, in build_runtime_image_in_folder
    _build_sandbox_image(
  File "/mnt/d/github/OpenDevin/openhands/runtime/utils/runtime_build.py", line 352, in _build_sandbox_image
    image_name = runtime_builder.build(
                 ^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/d/github/OpenDevin/openhands/runtime/builder/docker.py", line 114, in build
    raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command '['docker', 'buildx', 'build', '--progress=plain', '--build-arg=OPENHANDS_RUNTIME_VERSION=0.12.3', '--build-arg=OPENHANDS_RUNTIME_BUILD_TIME=2024-11-08T20:48:42.303720', '--tag=ghcr.io/all-hands-ai/runtime:oh_v0.12.3_rzthzrruf4nl4ih5_n1ymk823ynfjmq8i', '--load', '/tmp/tmpgn3bmnwu']' returned non-zero exit status 1.

OpenHands Installation

Development workflow

OpenHands Version

0.12.3

Operating System

WSL on Windows

Logs, Errors, Screenshots, and Additional Context

No response

mamoodi commented 2 weeks ago

I see that you mentioned Development Workflow and you prefer running it like that, but does the docker command work on WSL at least?

tobitege commented 2 weeks ago

Yes, the docker command seems to work. Strangely, putting a simple "ls -al" into terminal made the terminal hang till I issued another command in chat.

malhotra5 commented 2 weeks ago

+1 on this; using MacOS

Srishti-Chouhan commented 2 weeks ago

I'm facing this issue too (running WSL and development workflow)

mamoodi commented 2 weeks ago

Anyone with WSL able to tackle this issue? Development workflow seems broken on WSL.

malhotra5 commented 2 weeks ago

Running rm ~/.docker/config.json, restarting docker, and rebuilding Openhands resolved this issue for me. I'm am, however, on MacOS.

csmith49 commented 1 week ago

I'm running into this using the development workflow (needed for the benchmarking scripts) in a Ubuntu 20.04 container.