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

[Bug]: Error Creating Controller - Docker Mounts Denied in MacOS with Latest Image #1916

Open
2 tasks done
paulmaunders opened this issue May 20, 2024 · 3 comments
Open
2 tasks done
Labels
bug Something isn't working severity:low Minor issues, code cleanup, etc

Comments

@paulmaunders
Copy link

paulmaunders commented May 20, 2024

Is there an existing issue for the same bug?

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

  1. Set up the necessary environment variables and workspace directory.
  2. 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
@paulmaunders paulmaunders added the bug Something isn't working label May 20, 2024
@K-tang-mkv
Copy link
Contributor

The latest image version works well for me and correctly runs the sandbox container. I found that the path my sandbox container mounts is /home/opendevin/.cache, as set in line 395 of ssh_box.py, which is allowed for mounting. However, your path /app/opendevin/.cache is not permitted for mounting.
Screen Shot 2024-05-21 at 10 04 59 AM

@ksingh-scogo
Copy link

  • 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

@SmartManoj
Copy link
Collaborator

@ksingh-scogo Which version are you running?

@SmartManoj SmartManoj added the severity:low Minor issues, code cleanup, etc label May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working severity:low Minor issues, code cleanup, etc
Projects
None yet
Development

No branches or pull requests

4 participants