OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

Error creating controller. Please check Docker is running using `docker ps`.

Open AIhaisi opened this issue 10 months ago • 14 comments

There are logs:

2024-04-19 21:40:10 INFO: Started server process [1] 2024-04-19 21:40:10 INFO: Waiting for application startup. 2024-04-19 21:40:10 INFO: Application startup complete. 2024-04-19 21:40:10 INFO: Uvicorn running on http://0.0.0.0:3000 (Press CTRL+C to quit) 2024-04-19 21:40:15 INFO: ('172.17.0.1', 45180) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiI1NzNjMGQzNi1hMzdlLTRkYWQtYjdjYy0xMzY3YTU3ZGM5NDMifQ.XOJV2GTeQpwaXW3v7vr7sPK_1CPXv4fxefY69GA1JfE" [accepted] 2024-04-19 21:40:15 INFO: connection open 2024-04-19 21:40:15 Starting loop_recv for sid: 573c0d36-a37e-4dad-b7cc-1367a57dc943 2024-04-19 21:40:15 INFO: 172.17.0.1:45202 - "GET /api/messages/total HTTP/1.1" 200 OK 2024-04-19 21:40:15 INFO: 172.17.0.1:45194 - "GET /api/configurations HTTP/1.1" 200 OK 2024-04-19 21:40:15 13:40:15 - opendevin:ERROR: exec_box.py:55 - Please check Docker is running using docker ps. 2024-04-19 21:40:15 13:40:15 - opendevin:ERROR: agent.py:127 - Error creating controller: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 21:40:15 Traceback (most recent call last): 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 793, in urlopen 2024-04-19 21:40:15 response = self._make_request( 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 496, in _make_request 2024-04-19 21:40:15 conn.request( 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 400, in request 2024-04-19 21:40:15 self.endheaders() 2024-04-19 21:40:15 File "/usr/local/lib/python3.12/http/client.py", line 1331, in endheaders 2024-04-19 21:40:15 self._send_output(message_body, encode_chunked=encode_chunked) 2024-04-19 21:40:15 File "/usr/local/lib/python3.12/http/client.py", line 1091, in _send_output 2024-04-19 21:40:15 self.send(msg) 2024-04-19 21:40:15 File "/usr/local/lib/python3.12/http/client.py", line 1035, in send 2024-04-19 21:40:15 self.connect() 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/transport/unixconn.py", line 27, in connect 2024-04-19 21:40:15 sock.connect(self.unix_socket) 2024-04-19 21:40:15 FileNotFoundError: [Errno 2] No such file or directory 2024-04-19 21:40:15 2024-04-19 21:40:15 During handling of the above exception, another exception occurred: 2024-04-19 21:40:15 2024-04-19 21:40:15 Traceback (most recent call last): 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/requests/adapters.py", line 486, in send 2024-04-19 21:40:15 resp = conn.urlopen( 2024-04-19 21:40:15 ^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 847, in urlopen 2024-04-19 21:40:15 retries = retries.increment( 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 470, in increment 2024-04-19 21:40:15 raise reraise(type(error), error, _stacktrace) 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 38, in reraise 2024-04-19 21:40:15 raise value.with_traceback(tb) 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 793, in urlopen 2024-04-19 21:40:15 response = self._make_request( 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 496, in _make_request 2024-04-19 21:40:15 conn.request( 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 400, in request 2024-04-19 21:40:15 self.endheaders() 2024-04-19 21:40:15 File "/usr/local/lib/python3.12/http/client.py", line 1331, in endheaders 2024-04-19 21:40:15 self._send_output(message_body, encode_chunked=encode_chunked) 2024-04-19 21:40:15 File "/usr/local/lib/python3.12/http/client.py", line 1091, in _send_output 2024-04-19 21:40:15 self.send(msg) 2024-04-19 21:40:15 File "/usr/local/lib/python3.12/http/client.py", line 1035, in send 2024-04-19 21:40:15 self.connect() 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/transport/unixconn.py", line 27, in connect 2024-04-19 21:40:15 sock.connect(self.unix_socket) 2024-04-19 21:40:15 urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 21:40:15 2024-04-19 21:40:15 During handling of the above exception, another exception occurred: 2024-04-19 21:40:15 2024-04-19 21:40:15 Traceback (most recent call last): 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 213, in _retrieve_server_version 2024-04-19 21:40:15 return self.version(api_version=False)["ApiVersion"] 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/api/daemon.py", line 181, in version 2024-04-19 21:40:15 return self._result(self._get(url), json=True) 2024-04-19 21:40:15 ^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/utils/decorators.py", line 44, in inner 2024-04-19 21:40:15 return f(self, *args, **kwargs) 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 236, in _get 2024-04-19 21:40:15 return self.get(url, **self._set_request_timeout(kwargs)) 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/requests/sessions.py", line 602, in get 2024-04-19 21:40:15 return self.request("GET", url, **kwargs) 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request 2024-04-19 21:40:15 resp = self.send(prep, **send_kwargs) 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send 2024-04-19 21:40:15 r = adapter.send(request, **kwargs) 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/requests/adapters.py", line 501, in send 2024-04-19 21:40:15 raise ConnectionError(err, request=request) 2024-04-19 21:40:15 requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 21:40:15 2024-04-19 21:40:15 The above exception was the direct cause of the following exception: 2024-04-19 21:40:15 2024-04-19 21:40:15 Traceback (most recent call last): 2024-04-19 21:40:15 File "/app/opendevin/server/agent/agent.py", line 118, in create_controller 2024-04-19 21:40:15 self.controller = AgentController( 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/opendevin/controller/agent_controller.py", line 51, in init 2024-04-19 21:40:15 self.command_manager = CommandManager(self.id, container_image) 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/opendevin/controller/command_manager.py", line 20, in init 2024-04-19 21:40:15 self.shell = DockerExecBox( 2024-04-19 21:40:15 ^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/opendevin/sandbox/exec_box.py", line 57, in init 2024-04-19 21:40:15 raise ex 2024-04-19 21:40:15 File "/app/opendevin/sandbox/exec_box.py", line 53, in init 2024-04-19 21:40:15 self.docker_client = docker.from_env() 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/client.py", line 94, in from_env 2024-04-19 21:40:15 return cls( 2024-04-19 21:40:15 ^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/client.py", line 45, in init 2024-04-19 21:40:15 self.api = APIClient(*args, **kwargs) 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 197, in init 2024-04-19 21:40:15 self._version = self._retrieve_server_version() 2024-04-19 21:40:15 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:40:15 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 220, in _retrieve_server_version 2024-04-19 21:40:15 raise DockerException( 2024-04-19 21:40:15 docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 21:44:53 INFO: 172.17.0.1:54070 - "GET / HTTP/1.1" 307 Temporary Redirect 2024-04-19 21:44:53 INFO: ('172.17.0.1', 54084) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiI1NzNjMGQzNi1hMzdlLTRkYWQtYjdjYy0xMzY3YTU3ZGM5NDMifQ.XOJV2GTeQpwaXW3v7vr7sPK_1CPXv4fxefY69GA1JfE" [accepted] 2024-04-19 21:44:53 INFO: connection open 2024-04-19 21:44:53 Starting loop_recv for sid: 573c0d36-a37e-4dad-b7cc-1367a57dc943 2024-04-19 21:44:53 INFO: 172.17.0.1:54070 - "GET /locales/zh/translation.json HTTP/1.1" 404 Not Found 2024-04-19 21:44:53 INFO: 172.17.0.1:54070 - "GET /api/refresh-files HTTP/1.1" 200 OK 2024-04-19 21:44:53 INFO: 172.17.0.1:54072 - "GET /api/messages/total HTTP/1.1" 200 OK 2024-04-19 21:44:53 INFO: 172.17.0.1:54070 - "GET /api/configurations HTTP/1.1" 200 OK 2024-04-19 21:44:53 13:44:53 - opendevin:ERROR: exec_box.py:55 - Please check Docker is running using docker ps. 2024-04-19 21:44:53 13:44:53 - opendevin:ERROR: agent.py:127 - Error creating controller: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 21:44:53 Traceback (most recent call last): 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 793, in urlopen 2024-04-19 21:44:53 response = self._make_request( 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 496, in _make_request 2024-04-19 21:44:53 conn.request( 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 400, in request 2024-04-19 21:44:53 self.endheaders() 2024-04-19 21:44:53 File "/usr/local/lib/python3.12/http/client.py", line 1331, in endheaders 2024-04-19 21:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 2024-04-19 21:44:53 File "/usr/local/lib/python3.12/http/client.py", line 1091, in _send_output 2024-04-19 21:44:53 self.send(msg) 2024-04-19 21:44:53 File "/usr/local/lib/python3.12/http/client.py", line 1035, in send 2024-04-19 21:44:53 self.connect() 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/transport/unixconn.py", line 27, in connect 2024-04-19 21:44:53 sock.connect(self.unix_socket) 2024-04-19 21:44:53 FileNotFoundError: [Errno 2] No such file or directory 2024-04-19 21:44:53 2024-04-19 21:44:53 During handling of the above exception, another exception occurred: 2024-04-19 21:44:53 2024-04-19 21:44:53 Traceback (most recent call last): 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/requests/adapters.py", line 486, in send 2024-04-19 21:44:53 resp = conn.urlopen( 2024-04-19 21:44:53 ^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 847, in urlopen 2024-04-19 21:44:53 retries = retries.increment( 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 470, in increment 2024-04-19 21:44:53 raise reraise(type(error), error, _stacktrace) 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 38, in reraise 2024-04-19 21:44:53 raise value.with_traceback(tb) 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 793, in urlopen 2024-04-19 21:44:53 response = self._make_request( 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 496, in _make_request 2024-04-19 21:44:53 conn.request( 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 400, in request 2024-04-19 21:44:53 self.endheaders() 2024-04-19 21:44:53 File "/usr/local/lib/python3.12/http/client.py", line 1331, in endheaders 2024-04-19 21:44:53 self._send_output(message_body, encode_chunked=encode_chunked) 2024-04-19 21:44:53 File "/usr/local/lib/python3.12/http/client.py", line 1091, in _send_output 2024-04-19 21:44:53 self.send(msg) 2024-04-19 21:44:53 File "/usr/local/lib/python3.12/http/client.py", line 1035, in send 2024-04-19 21:44:53 self.connect() 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/transport/unixconn.py", line 27, in connect 2024-04-19 21:44:53 sock.connect(self.unix_socket) 2024-04-19 21:44:53 urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 21:44:53 2024-04-19 21:44:53 During handling of the above exception, another exception occurred: 2024-04-19 21:44:53 2024-04-19 21:44:53 Traceback (most recent call last): 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 213, in _retrieve_server_version 2024-04-19 21:44:53 return self.version(api_version=False)["ApiVersion"] 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/api/daemon.py", line 181, in version 2024-04-19 21:44:53 return self._result(self._get(url), json=True) 2024-04-19 21:44:53 ^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/utils/decorators.py", line 44, in inner 2024-04-19 21:44:53 return f(self, *args, **kwargs) 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 236, in _get 2024-04-19 21:44:53 return self.get(url, **self._set_request_timeout(kwargs)) 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/requests/sessions.py", line 602, in get 2024-04-19 21:44:53 return self.request("GET", url, **kwargs) 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request 2024-04-19 21:44:53 resp = self.send(prep, **send_kwargs) 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send 2024-04-19 21:44:53 r = adapter.send(request, **kwargs) 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/requests/adapters.py", line 501, in send 2024-04-19 21:44:53 raise ConnectionError(err, request=request) 2024-04-19 21:44:53 requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 21:44:53 2024-04-19 21:44:53 The above exception was the direct cause of the following exception: 2024-04-19 21:44:53 2024-04-19 21:44:53 Traceback (most recent call last): 2024-04-19 21:44:53 File "/app/opendevin/server/agent/agent.py", line 118, in create_controller 2024-04-19 21:44:53 self.controller = AgentController( 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/opendevin/controller/agent_controller.py", line 51, in init 2024-04-19 21:44:53 self.command_manager = CommandManager(self.id, container_image) 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/opendevin/controller/command_manager.py", line 20, in init 2024-04-19 21:44:53 self.shell = DockerExecBox( 2024-04-19 21:44:53 ^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/opendevin/sandbox/exec_box.py", line 57, in init 2024-04-19 21:44:53 raise ex 2024-04-19 21:44:53 File "/app/opendevin/sandbox/exec_box.py", line 53, in init 2024-04-19 21:44:53 self.docker_client = docker.from_env() 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/client.py", line 94, in from_env 2024-04-19 21:44:53 return cls( 2024-04-19 21:44:53 ^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/client.py", line 45, in init 2024-04-19 21:44:53 self.api = APIClient(*args, **kwargs) 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 197, in init 2024-04-19 21:44:53 self._version = self._retrieve_server_version() 2024-04-19 21:44:53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 21:44:53 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 220, in _retrieve_server_version 2024-04-19 21:44:53 raise DockerException( 2024-04-19 21:44:53 docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 21:44:55 INFO: 172.17.0.1:54070 - "GET /api/messages HTTP/1.1" 200 OK 2024-04-19 21:45:06 13:45:06 - opendevin:INFO: session.py:39 - WebSocket disconnected, sid: 573c0d36-a37e-4dad-b7cc-1367a57dc943 2024-04-19 21:45:06 INFO: connection closed —————————————— Already set the exports;

I used the under command: docker run
-e LLM_API_KEY
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_DIR
-v $WORKSPACE_DIR:/opt/workspace_base
-v /var/run/docker.sock:/var/run/docker.sock
-p 3000:3000
-e SANDBOX_TYPE=exec
ghcr.io/opendevin/opendevin:0.3.1

what's the problem?

AIhaisi avatar Apr 19 '24 13:04 AIhaisi

Hmm. Is there a reason you're using the exec sandbox? Does removing that env var cause a different error?

rbren avatar Apr 19 '24 14:04 rbren

  • If you are using linux Reference here

your problem seems to lie in the fact that you are not allowed to access the socket /var/run/docker.sock. Commonly this socket is owned by user root and group docker with permissions to read/write for user and group, but not for others. This should look something like this:

$ ls -l /var/run/docker.sock
srw-rw---- 1 root docker 0 Jan 31 16:02 /var/run/docker.sock

The trick is to add your user to the docker group:

$ sudo usermod -aG docker your-user-name

After this, log out and back in again. You should now be able to use it.

or

use sudo with docker command.

  • If you are using windows with docker destop and WSL2 Integration Reference here

you need to enable WSL Integration for the required distro in Windows Docker Desktop(Settings -> Resources-> WSL Integration -> Enable integration with required distros).

image

Umpire2018 avatar Apr 19 '24 14:04 Umpire2018

Hmm. Is there a reason you're using the exec sandbox? Does removing that env var cause a different error?

Yes,without using that it would be like this:

2024-04-19 23:18:21 15:18:21 - opendevin:ERROR: ssh_box.py:68 - Please check Docker is running using docker ps. 2024-04-19 23:18:21 15:18:21 - opendevin:ERROR: agent.py:127 - Error creating controller: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 23:18:21 Traceback (most recent call last): 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 793, in urlopen 2024-04-19 23:18:21 response = self._make_request( 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 496, in _make_request 2024-04-19 23:18:21 conn.request( 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 400, in request 2024-04-19 23:18:21 self.endheaders() 2024-04-19 23:18:21 File "/usr/local/lib/python3.12/http/client.py", line 1331, in endheaders 2024-04-19 23:18:21 self._send_output(message_body, encode_chunked=encode_chunked) 2024-04-19 23:18:21 File "/usr/local/lib/python3.12/http/client.py", line 1091, in _send_output 2024-04-19 23:18:21 self.send(msg) 2024-04-19 23:18:21 File "/usr/local/lib/python3.12/http/client.py", line 1035, in send 2024-04-19 23:18:21 self.connect() 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/transport/unixconn.py", line 27, in connect 2024-04-19 23:18:21 sock.connect(self.unix_socket) 2024-04-19 23:18:21 FileNotFoundError: [Errno 2] No such file or directory 2024-04-19 23:18:21 2024-04-19 23:18:21 During handling of the above exception, another exception occurred: 2024-04-19 23:18:19 INFO: 172.17.0.1:51982 - "GET / HTTP/1.1" 307 Temporary Redirect 2024-04-19 23:18:19 Starting loop_recv for sid: 573c0d36-a37e-4dad-b7cc-1367a57dc943 2024-04-19 23:18:19 INFO: 172.17.0.1:51982 - "GET /locales/zh/translation.json HTTP/1.1" 404 Not Found 2024-04-19 23:18:20 INFO: 172.17.0.1:51982 - "GET /api/refresh-files HTTP/1.1" 200 OK 2024-04-19 23:18:20 INFO: 172.17.0.1:51980 - "GET /api/messages/total HTTP/1.1" 200 OK 2024-04-19 23:18:20 INFO: 172.17.0.1:51982 - "GET /api/configurations HTTP/1.1" 200 OK 2024-04-19 23:18:21 2024-04-19 23:18:21 Traceback (most recent call last): 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/requests/adapters.py", line 486, in send 2024-04-19 23:18:21 resp = conn.urlopen( 2024-04-19 23:18:21 ^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 847, in urlopen 2024-04-19 23:18:21 retries = retries.increment( 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/urllib3/util/retry.py", line 470, in increment 2024-04-19 23:18:21 raise reraise(type(error), error, _stacktrace) 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/urllib3/util/util.py", line 38, in reraise 2024-04-19 23:18:21 raise value.with_traceback(tb) 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 793, in urlopen 2024-04-19 23:18:21 response = self._make_request( 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/urllib3/connectionpool.py", line 496, in _make_request 2024-04-19 23:18:21 conn.request( 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/urllib3/connection.py", line 400, in request 2024-04-19 23:18:21 self.endheaders() 2024-04-19 23:18:21 File "/usr/local/lib/python3.12/http/client.py", line 1331, in endheaders 2024-04-19 23:18:21 self._send_output(message_body, encode_chunked=encode_chunked) 2024-04-19 23:18:21 File "/usr/local/lib/python3.12/http/client.py", line 1091, in _send_output 2024-04-19 23:18:21 self.send(msg) 2024-04-19 23:18:21 File "/usr/local/lib/python3.12/http/client.py", line 1035, in send 2024-04-19 23:18:21 self.connect() 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/transport/unixconn.py", line 27, in connect 2024-04-19 23:18:21 sock.connect(self.unix_socket) 2024-04-19 23:18:21 urllib3.exceptions.ProtocolError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 23:18:21 2024-04-19 23:18:21 During handling of the above exception, another exception occurred: 2024-04-19 23:18:21 2024-04-19 23:18:21 Traceback (most recent call last): 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 213, in _retrieve_server_version 2024-04-19 23:18:21 return self.version(api_version=False)["ApiVersion"] 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/api/daemon.py", line 181, in version 2024-04-19 23:18:21 return self._result(self._get(url), json=True) 2024-04-19 23:18:21 ^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/utils/decorators.py", line 44, in inner 2024-04-19 23:18:21 return f(self, *args, **kwargs) 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 236, in _get 2024-04-19 23:18:21 return self.get(url, **self._set_request_timeout(kwargs)) 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/requests/sessions.py", line 602, in get 2024-04-19 23:18:21 return self.request("GET", url, **kwargs) 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/requests/sessions.py", line 589, in request 2024-04-19 23:18:21 resp = self.send(prep, **send_kwargs) 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/requests/sessions.py", line 703, in send 2024-04-19 23:18:21 r = adapter.send(request, **kwargs) 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/requests/adapters.py", line 501, in send 2024-04-19 23:18:21 raise ConnectionError(err, request=request) 2024-04-19 23:18:21 requests.exceptions.ConnectionError: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory')) 2024-04-19 23:18:21 2024-04-19 23:18:21 The above exception was the direct cause of the following exception: 2024-04-19 23:18:21 2024-04-19 23:18:21 Traceback (most recent call last): 2024-04-19 23:18:21 File "/app/opendevin/server/agent/agent.py", line 118, in create_controller 2024-04-19 23:18:21 self.controller = AgentController( 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/opendevin/controller/agent_controller.py", line 51, in init 2024-04-19 23:18:21 self.command_manager = CommandManager(self.id, container_image) 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/opendevin/controller/command_manager.py", line 26, in init 2024-04-19 23:18:21 self.shell = DockerSSHBox( 2024-04-19 23:18:21 ^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/opendevin/sandbox/ssh_box.py", line 70, in init 2024-04-19 23:18:21 raise ex 2024-04-19 23:18:21 File "/app/opendevin/sandbox/ssh_box.py", line 66, in init 2024-04-19 23:18:21 self.docker_client = docker.from_env() 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/client.py", line 94, in from_env 2024-04-19 23:18:21 return cls( 2024-04-19 23:18:21 ^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/client.py", line 45, in init 2024-04-19 23:18:21 self.api = APIClient(*args, **kwargs) 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 197, in init 2024-04-19 23:18:21 self._version = self._retrieve_server_version() 2024-04-19 23:18:21 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 2024-04-19 23:18:21 File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 220, in _retrieve_server_version 2024-04-19 23:18:21 raise DockerException( 2024-04-19 23:18:21 docker.errors.DockerException: Error while fetching server API version: ('Connection aborted.', FileNotFoundError(2, 'No such file or directory'))

AIhaisi avatar Apr 19 '24 15:04 AIhaisi

  • If you are using linux Reference here

your problem seems to lie in the fact that you are not allowed to access the socket /var/run/docker.sock. Commonly this socket is owned by user root and group docker with permissions to read/write for user and group, but not for others. This should look something like this:

$ ls -l /var/run/docker.sock
srw-rw---- 1 root docker 0 Jan 31 16:02 /var/run/docker.sock

The trick is to add your user to the docker group:

$ sudo usermod -aG docker your-user-name

After this, log out and back in again. You should now be able to use it.

or

use sudo with docker command.

  • If you are using windows with docker destop and WSL2 Integration Reference here

you need to enable WSL Integration for the required distro in Windows Docker Desktop(Settings -> Resources-> WSL Integration -> Enable integration with required distros).

image

I had same issue, I added user to docker group and problem fixed , thanks

civickplanc avatar Apr 20 '24 14:04 civickplanc

MacOs terminal can't run sudo usermod -aG docker your-user-name

sudo: usermod: command not found --> how to solve this

MEEP00H avatar Apr 20 '24 15:04 MEEP00H

@MEEP00H

To add a user to the Docker group on macOS, you can use the following commands in the Terminal. Replace your-user-name with your actual macOS username:

sudo dseditgroup -o edit -a your-user-name -t user docker

Umpire2018 avatar Apr 21 '24 02:04 Umpire2018

I change the image to DOCKER_IMAGE = ghcr.io/opendevin/opendevin in the MakeFile, this issue finnally have been resolved.

huqianghui avatar Apr 24 '24 09:04 huqianghui

@AIhaisi Did you try the solution shared in the comment above? https://github.com/OpenDevin/OpenDevin/issues/1226#issuecomment-2066760909

enyst avatar Apr 26 '24 21:04 enyst

I'm still getting this error on macos when I run the sequence of make build, make setup-config, and make run

Docker ps seems to run:

$ docker ps
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES

The docker group does not seem to be found.

$ sudo dseditgroup -o edit -a gneubig -t user docker
Group not found.

Building the app also fails:

$ ./containers/build.sh app opendevin
Building: app
Tags: 
Repo: ghcr.io/opendevin/opendevin
Base dir: .
[+] Building 0.0s (0/0)                                                                                                                       docker:desktop-linux
ERROR: Cache export is not supported for the docker driver.
Switch to a different driver, or turn on the containerd image store, and try again.
Learn more at https://docs.docker.com/go/build-cache-backends/

I'll continue poking around but any advice would be welcome.

neubig avatar Apr 28 '24 18:04 neubig

For reference, creating a symlink of the docker socker helped resolve the issue for me, per this post.

sudo ln -s $HOME/.docker/run/docker.sock /var/run/docker.sock

It'd be better if we didn't have to require every developer to do this though, maybe there's a better way?

neubig avatar Apr 28 '24 20:04 neubig

@neubig very strange--I've never seen the docker socket in $HOME. I also find it strange that you can't just build the app...what does docker build . -f containers/app/Dockerfile -t opendevin-app give you?

rbren avatar Apr 29 '24 12:04 rbren

A bit more digging found this:

As the /var/run is mounted as a tmpfs, its content is deleted on restart, symlink to the Docker socket included. To ensure the Docker socket exists after restart, Docker Desktop sets up a launchd startup task that creates the symlink by running ln -s -f /Users/<user>/.docker/run/docker.sock /var/run/docker.sock. This ensures the you aren't prompted on each startup to create the symlink. If you don't enable this option at installation, the symlink and the startup task is not created and you may have to explicitly set the DOCKER_HOST environment variable to /Users/<user>/.docker/run/docker.sock in the clients it is using. The Docker CLI relies on the current context to retrieve the socket path, the current context is set to desktop-linux on Docker Desktop startup.

So it may be an issue with my config.

UPDATE: indeed, it was. I needed to enable the following setting in "Settings > Advanced" in the mac app.

Screenshot 2024-04-29 at 12 37 19 PM

It seems like this almost be a bug in the Docker python bindings upstream, in that they can't identify the correct socket if it's not in the default location?

neubig avatar Apr 29 '24 16:04 neubig

@rbren , thanks for the debugging info! docker build . -f containers/app/Dockerfile -t opendevin-app seems to be working for me.

neubig avatar Apr 29 '24 16:04 neubig

  • If you are using linux Reference here

your problem seems to lie in the fact that you are not allowed to access the socket /var/run/docker.sock. Commonly this socket is owned by user root and group docker with permissions to read/write for user and group, but not for others. This should look something like this:

$ ls -l /var/run/docker.sock
srw-rw---- 1 root docker 0 Jan 31 16:02 /var/run/docker.sock

The trick is to add your user to the docker group:

$ sudo usermod -aG docker your-user-name

After this, log out and back in again. You should now be able to use it.

or

use sudo with docker command.

  • If you are using windows with docker destop and WSL2 Integration Reference here

you need to enable WSL Integration for the required distro in Windows Docker Desktop(Settings -> Resources-> WSL Integration -> Enable integration with required distros).

image

Hey, i enabled it but still gets the Error (windows)... Can someone help me pls

zGamerZz avatar May 03 '24 11:05 zGamerZz

Could you provide the error?

SmartManoj avatar May 03 '24 12:05 SmartManoj

Could you provide the error?

Sure, here is the terminal log:

INFO: Started server process [1] 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:33580 - "GET /index.html HTTP/1.1" 304 Not Modified INFO: 172.17.0.1:33580 - "GET /assets/index-D59teWsw.js HTTP/1.1" 304 Not Modified INFO: 172.17.0.1:33596 - "GET /assets/index-CZQzs2DR.css HTTP/1.1" 304 Not Modified INFO: ('172.17.0.1', 33604) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiIwMmMyZTJkZS0wMWVhLTQ4NDMtYWE2NC1lOGJkZWQyMzQyYTQifQ.-ijYRPd6NHBQvqIkNsFVj-0zQR2pdd7_z13oqlVNXFc" [accepted] INFO: connection open Starting loop_recv for sid: 02c2e2de-01ea-4843-aa64-e8bded2342a4 INFO: 172.17.0.1:33596 - "GET /api/refresh-files HTTP/1.1" 200 OK 12:01:36 - opendevin:INFO: agent.py:144 - Creating agent MonologueAgent using LLM gpt-3.5-turbo 12:01:36 - opendevin:INFO: llm.py:51 - Initializing LLM with model: gpt-3.5-turbo 12:01:37 - opendevin:INFO: ssh_box.py:353 - Container stopped 12:01:37 - opendevin:INFO: ssh_box.py:373 - Mounting workspace directory: workspace 12:01:38 - opendevin:INFO: ssh_box.py:396 - Container started 12:01:39 - opendevin:INFO: ssh_box.py:413 - waiting for container to start: 1, container status: running 12:01:39 - opendevin:INFO: ssh_box.py:178 - Connecting to [email protected] via ssh. If you encounter any issues, you can try ssh -v -p 34617 [email protected] with the password '20cb14c4-a5f4-4f48-8a68-841c8b5caa66' and report the issue on GitHub. 12:01:39 - opendevin:ERROR: agent.py:155 - Error creating controller: Could not establish connection to host Traceback (most recent call last): File "/app/opendevin/server/agent/agent.py", line 147, in create_controller self.controller = AgentController( ^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/agent_controller.py", line 57, in init self.action_manager = ActionManager(self.id) ^^^^^^^^^^^^^^^^^^^^^^ File "/app/opendevin/controller/action_manager.py", line 33, in init self.sandbox = DockerSSHBox( ^^^^^^^^^^^^^ File "/app/opendevin/sandbox/docker/ssh_box.py", line 91, in init self.start_ssh_session() File "/app/opendevin/sandbox/docker/ssh_box.py", line 181, in start_ssh_session self.ssh.login(hostname, username, self._ssh_password, File "/app/.venv/lib/python3.12/site-packages/pexpect/pxssh.py", line 424, in login raise ExceptionPxssh('Could not establish connection to host') pexpect.pxssh.ExceptionPxssh: Could not establish connection to host INFO: 172.17.0.1:33580 - "GET /api/messages/total HTTP/1.1" 200 OK INFO: 172.17.0.1:33596 - "GET /api/litellm-models HTTP/1.1" 200 OK INFO: 172.17.0.1:33596 - "GET /api/agents HTTP/1.1" 200 OK INFO: 172.17.0.1:33596 - "GET /api/messages HTTP/1.1" 200 OK

zGamerZz avatar May 03 '24 12:05 zGamerZz

if you have

Error creating controller: 500 Server Error for http+docker://localhost/v1.45/containers/create?name=opendevin-sandbox-f17cc78d-f7be-4a81-943c-94b5429c41ef67cf4670-9e7c-458b-9e09-5872f268ae04: Internal Server Error ("invalid volume specification: ':/workspace:rw'")

in the docker logs, you need to export workspace variable again

aj47 avatar May 08 '24 13:05 aj47

I had this error on Ubuntu 24.04 - Docker 26.1.1

For me this worked after changing the permission to the docker socket.

sudo chmod 666 /var/run/docker.sock

ataylor05 avatar May 08 '24 14:05 ataylor05

Hey all (especially @ataylor05)--some of these issue are likely fixed in the most recent version (0.5.3). Take a look and let us know!

rbren avatar May 11 '24 14:05 rbren

i am still facing this issue on a Macbook ? I have tried all the tricks described above for macs.

nlauchande avatar May 11 '24 17:05 nlauchande

I got resolution by upgrading the Docker version to the last version . i think I should update the docs with this on troubleshooting.

nlauchande avatar May 11 '24 19:05 nlauchande

Hello Professor @neubig

I was trying to launch the localhost upon starting my docker desktop and ran the workspace command in windows.

Error creating controller. Please check Docker is running and visit https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting for more debugging information..

I was getting this error. I checked the troubleshoot page and verified my docker desktop version, and also whether the docker is running. They are running fine, however I'm getting the same issue when setting to default reset.

image

image

gmukku avatar Jun 14 '24 19:06 gmukku

@gmukku You're running on windows, just to be sure, are you using WSL? It is needed.

It might be better if you start a new issue, and please fill in the template, it can really help to figure out what can be the problem.

enyst avatar Jun 14 '24 20:06 enyst

@enyst I am able to launch the localhost now. Thank you.

gmukku avatar Jun 14 '24 21:06 gmukku

gmukku

I'm using linux. I have the same problem using CodeActAgent, even is docker is working as expeted [link]. (https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting ) :

  • no sudo
  • both opendevi container and sandbox latest version up and running (i can ssh inot sandbox container)
  • docker latest version

Selecting CoderAgent seems to works.

Any explanations?

Buckler89 avatar Jun 29 '24 21:06 Buckler89

That sounds strange, maybe a transitory issue @Buckler89? If not, can you please open a new issue and fill in the template, including the errors in the log, we can figure it out.

enyst avatar Jun 30 '24 18:06 enyst