[Bug]: Error Creating Controller - Docker Mounts Denied in MacOS with Latest Image
paulmaunders opened this issue · comments
Is there an existing issue for the same bug?
- I have checked the troubleshooting document at https://opendevin.github.io/OpenDevin/modules/usage/troubleshooting
- I have checked the existing issues.
Describe the bug
When running the latest Docker image of OpenDevin on MacOS, the application fails to start correctly with an error message "Error creating controller". The issue appears to be related to Docker mount permissions, specifically for the path /app/opendevin/.cache.
Internal Server Error ("Mounts denied: The path /app/opendevin/.cache is not shared from the host and is not known to Docker. You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing. See https://docs.docker.com/desktop/mac for more info.")
The 0.5 image works fine.
Current Version
ghcr.io/opendevin/opendevin:latest
Installation and Configuration
docker run \
-it \
--pull=always \
-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 \
ghcr.io/opendevin/opendevin:latest
Model and Agent
- Model: gpt-4o
- Agent: CodeActAgent
Reproduction Steps
- Set up the necessary environment variables and workspace directory.
- Run the following Docker command with the latest image (see above command).
Logs, Errors, Screenshots, and Additional Context
paulmaunders@pauls-laptop test-opendevin % docker run \
-it \
--pull=always \
-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 \
ghcr.io/opendevin/opendevin:latest
latest: Pulling from opendevin/opendevin
Digest: sha256:881f4034588726f037f1b87c7224c426d9f496f4d8843ee9f54ff8e97c046202
Status: Image is up to date for ghcr.io/opendevin/opendevin:latest
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: 192.168.65.1:23112 - "GET /index.html HTTP/1.1" 304 Not Modified
INFO: ('192.168.65.1', 23114) - "WebSocket /ws?token=[redacted]" [accepted]
Starting loop_recv for sid: bca97e27-aaba-477f-973b-13e847da2f37
INFO: connection open
INFO: 192.168.65.1:23113 - "GET /api/litellm-models HTTP/1.1" 200 OK
13:31:51 - opendevin:INFO: agent.py:145 - Creating agent CodeActAgent using LLM gpt-4o
13:31:51 - opendevin:INFO: llm.py:52 - Initializing LLM with model: gpt-4o
13:31:52 - opendevin:INFO: ssh_box.py:357 - Container stopped
13:31:52 - opendevin:WARNING: ssh_box.py:369 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information.
13:31:52 - opendevin:INFO: ssh_box.py:377 - Mounting workspace directory: /Users/paulmaunders/Documents/Code/test-opendevin/workspace
13:31:53 - opendevin:ERROR: ssh_box.py:402 - Failed to start container
13:31:53 - opendevin:ERROR: agent.py:157 - Error creating controller: 500 Server Error for http+docker://localhost/v1.45/containers/f76ff18735316198efbf91fa9335f820f91f79bfc4056378885464cd83b2ff79/start: Internal Server Error ("Mounts denied:
The path /app/opendevin/.cache is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more info.")
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 265, in _raise_for_status
response.raise_for_status()
File "/app/.venv/lib/python3.12/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localhost/v1.45/containers/f76ff18735316198efbf91fa9335f820f91f79bfc4056378885464cd83b2ff79/start
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/opendevin/server/agent/agent.py", line 148, in create_controller
self.controller = AgentController(
^^^^^^^^^^^^^^^^
File "/app/opendevin/controller/agent_controller.py", line 50, in __init__
self.action_manager = ActionManager(self.id, container_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/opendevin/controller/action_manager.py", line 34, in __init__
self.sandbox = DockerSSHBox(
^^^^^^^^^^^^^
File "/app/opendevin/sandbox/docker/ssh_box.py", line 92, in __init__
self.restart_docker_container()
File "/app/opendevin/sandbox/docker/ssh_box.py", line 403, in restart_docker_container
raise ex
File "/app/opendevin/sandbox/docker/ssh_box.py", line 379, in restart_docker_container
self.container = self.docker_client.containers.run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/docker/models/containers.py", line 880, in run
container.start()
File "/app/.venv/lib/python3.12/site-packages/docker/models/containers.py", line 417, 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 1135, in start
self._raise_for_status(res)
File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 267, 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: 500 Server Error for http+docker://localhost/v1.45/containers/f76ff18735316198efbf91fa9335f820f91f79bfc4056378885464cd83b2ff79/start: Internal Server Error ("Mounts denied:
The path /app/opendevin/.cache is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more info.")
INFO: 192.168.65.1:23113 - "GET /api/agents HTTP/1.1" 200 OK
INFO: 192.168.65.1:23115 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO: 192.168.65.1:23112 - "GET /api/refresh-files HTTP/1.1" 200 OK
INFO: 192.168.65.1:23112 - "DELETE /api/messages HTTP/1.1" 200 OK
- Exact same issue while running on MacOS
docker run \
-it \
--pull=always \
-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 \
ghcr.io/opendevin/opendevin
latest: Pulling from opendevin/opendevin
Digest: sha256:881f4034588726f037f1b87c7224c426d9f496f4d8843ee9f54ff8e97c046202
Status: Image is up to date for ghcr.io/opendevin/opendevin:latest
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: 192.168.65.1:31735 - "GET /index.html HTTP/1.1" 200 OK
INFO: 192.168.65.1:18355 - "GET /assets/index-BFv3DKUU.css HTTP/1.1" 200 OK
INFO: 192.168.65.1:31735 - "GET /assets/index-9aeF_93y.js HTTP/1.1" 200 OK
INFO: ('192.168.65.1', 30768) - "WebSocket /ws?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzaWQiOiI0MjU3NTVkYS0wMDA0LTQ1MjYtYjQwNi0wZTU4MmZlOWRjMGMifQ.wStuIrK8qcTDjaFOyYK_d6lyj_Vv3rtI3z2-DGTI768" [accepted]
Starting loop_recv for sid: 425755da-0004-4526-b406-0e582fe9dc0c
INFO: connection open
INFO: 192.168.65.1:31735 - "GET /api/refresh-files HTTP/1.1" 200 OK
03:24:21 - opendevin:INFO: agent.py:145 - Creating agent MonologueAgent using LLM gpt-3.5-turbo
03:24:21 - opendevin:INFO: llm.py:52 - Initializing LLM with model: gpt-3.5-turbo
03:24:22 - opendevin:INFO: ssh_box.py:357 - Container stopped
03:24:22 - opendevin:WARNING: ssh_box.py:369 - Using port forwarding for Mac OS. Server started by OpenDevin will not be accessible from the host machine at the moment. See https://github.com/OpenDevin/OpenDevin/issues/897 for more information.
03:24:22 - opendevin:INFO: ssh_box.py:377 - Mounting workspace directory: /Users/ksingh/git/scogo/research/opendevin/workspace
03:24:22 - opendevin:ERROR: ssh_box.py:402 - Failed to start container
03:24:22 - opendevin:ERROR: agent.py:157 - Error creating controller: 500 Server Error for http+docker://localhost/v1.45/containers/6c83d93c34f0954790c76f5715356d4b32ac4853127055279c87bd946ed8d13d/start: Internal Server Error ("Mounts denied:
The path /app/opendevin/.cache is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more info.")
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 265, in _raise_for_status
response.raise_for_status()
File "/app/.venv/lib/python3.12/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: http+docker://localhost/v1.45/containers/6c83d93c34f0954790c76f5715356d4b32ac4853127055279c87bd946ed8d13d/start
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/app/opendevin/server/agent/agent.py", line 148, in create_controller
self.controller = AgentController(
^^^^^^^^^^^^^^^^
File "/app/opendevin/controller/agent_controller.py", line 50, in __init__
self.action_manager = ActionManager(self.id, container_image)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/opendevin/controller/action_manager.py", line 34, in __init__
self.sandbox = DockerSSHBox(
^^^^^^^^^^^^^
File "/app/opendevin/sandbox/docker/ssh_box.py", line 92, in __init__
self.restart_docker_container()
File "/app/opendevin/sandbox/docker/ssh_box.py", line 403, in restart_docker_container
raise ex
File "/app/opendevin/sandbox/docker/ssh_box.py", line 379, in restart_docker_container
self.container = self.docker_client.containers.run(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/docker/models/containers.py", line 880, in run
container.start()
File "/app/.venv/lib/python3.12/site-packages/docker/models/containers.py", line 417, 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 1135, in start
self._raise_for_status(res)
File "/app/.venv/lib/python3.12/site-packages/docker/api/client.py", line 267, 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: 500 Server Error for http+docker://localhost/v1.45/containers/6c83d93c34f0954790c76f5715356d4b32ac4853127055279c87bd946ed8d13d/start: Internal Server Error ("Mounts denied:
The path /app/opendevin/.cache is not shared from the host and is not known to Docker.
You can configure shared paths from Docker -> Preferences... -> Resources -> File Sharing.
See https://docs.docker.com/desktop/mac for more info.")
INFO: 192.168.65.1:31735 - "GET /api/litellm-models HTTP/1.1" 200 OK
INFO: 192.168.65.1:18355 - "GET /api/messages/total HTTP/1.1" 200 OK
INFO: 192.168.65.1:31735 - "GET /api/agents HTTP/1.1" 200 OK
INFO: 192.168.65.1:31735 - "DELETE /api/messages HTTP/1.1" 200 OK
@ksingh-scogo Which version are you running? (Latest only)
@K-tang-mkv It seems to be a Mac OS issue.
@paulmaunders, @ksingh-scogo What is your docker version?
Mounts denied. The paths ... are not shared from OS X and are not known to Docker
I'm running Docker version 26.0.0
I've just tried the 0.6 version and I don't see this error any more, but there is a different cache error and the app itself doesn't seem to work.
I tried setting the cache with:
export TRANSFORMERS_CACHE=$(pwd)/.cache
Then I ran:
% docker run -it \
--pull=always \
-e SANDBOX_USER_ID=$(id -u) \
-e PERSIST_SANDBOX="true" \
-e SSH_PASSWORD="make something up here" \
-e WORKSPACE_MOUNT_PATH=$OPENDEVIN_WORKSPACE \
-v $OPENDEVIN_WORKSPACE:/opt/workspace_base \
-v /var/run/docker.sock:/var/run/docker.sock \
-p 3000:3000 \
--add-host host.docker.internal:host-gateway \
--name opendevin-app-$(date +%Y%m%d%H%M%S) \
ghcr.io/opendevin/opendevin:0.6
It gives me this error:
There was a problem when trying to write in your cache folder (/home/enduser/.cache/huggingface/hub). You should set the environment variable TRANSFORMERS_CACHE to a writable directory.
So it doesn't look like it is using the environment variable I set. Also the app doesn't then work:
That is fixed in #2277
Also, the URL changed. Just http://localhost:3000/