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
Not able to run docker exec with both Ollama (llama3) and Docker installed on WSL2 (ubuntu). What am I missing? #1351
Comments
It looks like a Docker or host problem. Not something related to OpenDevin. |
Yes. That's why I added as question. Not issue directly related to OpenDevin. I have some rough steps which I noted when I setup my ollama and docker. I can share those here if it helps. |
Steps overview -
Here are detailed 3, 4 and 6 steps -3. Download and install ollama in ubuntuCommands - b. c. d. 4. Install DockerSteps from this official docker link -> Install using the apt repository Set up Docker's apt repository.Add Docker's official GPG key:
Add the repository to Apt sources:
Note Install the Docker packages.To install the latest version, run: Verify that the Docker Engine installation is successful by running the hello-world image.
This command downloads a test image and runs it in a container. When the container runs, it prints a confirmation message and exits. You have now successfully installed and started Docker Engine. Tip Post install stepsPost install steps official link -> Linux post-installation steps for Docker Engine | Docker Docs
6. Run OpenDevin
docker run \ --add-host host.docker.internal=host-gateway \ -e LLM_API_KEY="ollama" \ -e LLM_BASE_URL="http://host.docker.internal:11434" \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -v $WORKSPACE_BASE:/opt/workspace_base \ -v /var/run/docker.sock:/var/run/docker.sock \ -p 3000:3000 \ ghcr.io/opendevin/opendevin:0.3.1 OR docker run \ --add-host=host.docker.internal:host-gateway \ -e LLM_API_KEY="ollama" \ -e LLM_BASE_URL="http://host.docker.internal:11434" \ -e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \ -v $WORKSPACE_BASE:/opt/workspace_base \ -v /var/run/docker.sock:/var/run/docker.sock \ -p 3000:3000 \ ghcr.io/opendevin/opendevin:0.3.1 Validation commands for ollama and docker connectivitity
|
It's more suitable for your docker to be installed on the windows host. You can try it. WSL does't require additional docker.Because "host.docker.internal:host-gateway" is to solve the communication between windows host and wsl network. |
@tejeshwar-p Thank you for the detailed steps. Can you please confirm, have you also tried section Fixing It: https://github.com/OpenDevin/OpenDevin/blob/main/docs/guides/LocalLLMs.md#fixing-it ? |
Hi @enyst - Yeah. Already did that. This is how my ollama.service file looks - |
Thank you @SmartManoj. Will try and keep result posted. So, it means I have to do some tinkering with the existing OpenDevin's entrpoint.sh and Dockerfile. |
Describe your question
I have done setup of both Ollama (llama3) and Docker in my WSL2 (ubuntu). My operating system is Windows 10.
I get success response from model with these commands when I only test Ollama -
ollama list
andcurl http://localhost:11434/api/generate -d '{"model":"llama3","prompt":"hi"}'
However when I run this command -
docker exec f5f7a105ee5f curl http://host.docker.internal:11434/api/generate -d '{"model":"llama3","prompt":"hi"}'
I always get the same error -
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0 curl: (7) Failed to connect to host.docker.internal port 11434 after 0 ms: Couldn't connect to server
Can someone please help as no matter what I do, the setup just does not work with ollama and docker both installed in WSL?
Additional context
I have followed all the steps as mentioned in - https://github.com/OpenDevin/OpenDevin/blob/main/docs/guides/LocalLLMs.md#4-configuring-the-ollama-service-wsl
I have installed docker latest version and also followed the post installation steps of docker to run without requirement of sudo as described in - https://docs.docker.com/engine/install/linux-postinstall
Export command -
export WORKSPACE_BASE=$(pwd)
My docker run command -
FYI, I tried with
--add-host host.docker.internal=host-gateway
as well but still same issue.I have shutdown all the WSL2 sessions and restarted WSL2 but still no luck.
The text was updated successfully, but these errors were encountered: