Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
AIhaisi opened this issue Apr 19, 2024 · 22 comments · Fixed by #1453
Closed

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

AIhaisi opened this issue Apr 19, 2024 · 22 comments · Fixed by #1453
Labels
bug Something isn't working

Comments

@AIhaisi
Copy link

AIhaisi commented Apr 19, 2024

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 AIhaisi added the bug Something isn't working label Apr 19, 2024
@rbren
Copy link
Collaborator

rbren commented Apr 19, 2024

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

@Umpire2018
Copy link
Contributor

  • 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

@AIhaisi
Copy link
Author

AIhaisi commented Apr 19, 2024

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'))

@SmartManoj
Copy link
Collaborator

SmartManoj commented Apr 19, 2024

@civickplanc
Copy link

  • 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

@MEEP00H
Copy link

MEEP00H commented Apr 20, 2024

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

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

@Umpire2018
Copy link
Contributor

@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

@huqianghui
Copy link

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

@enyst
Copy link
Collaborator

enyst commented Apr 26, 2024

@AIhaisi Did you try the solution shared in the comment above?
#1226 (comment)

@neubig
Copy link
Contributor

neubig commented Apr 28, 2024

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
Copy link
Contributor

neubig commented Apr 28, 2024

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?

@rbren
Copy link
Collaborator

rbren commented Apr 29, 2024

@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?

@neubig
Copy link
Contributor

neubig commented Apr 29, 2024

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
Copy link
Contributor

neubig commented Apr 29, 2024

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

@zGamerZz
Copy link

zGamerZz commented May 3, 2024

  • 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

@SmartManoj
Copy link
Collaborator

Could you provide the error?

@zGamerZz
Copy link

zGamerZz commented May 3, 2024

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 root@host.docker.internal via ssh. If you encounter any issues, you can try ssh -v -p 34617 root@host.docker.internal 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

@aj47
Copy link
Contributor

aj47 commented May 8, 2024

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

@ataylor05
Copy link

ataylor05 commented May 8, 2024

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

@rbren
Copy link
Collaborator

rbren commented May 11, 2024

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!

@nlauchande
Copy link
Contributor

nlauchande commented May 11, 2024

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

@nlauchande
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.