Why is the port line in docker not filled in in the ollama project?

409 views Asked by At

I am running ollama in docker, but the port is not full.

enter image description here

The documentation says what to use docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama But I don't understand where to write it a little. To the ollama console? If yes, then, as I understand it, you need to write the following command docker run d v ollama:/root/.ollama p 11434:11434 name ollama ollama/ollama

But an error occurs, there is no such file.

I also checked Docker, and there is a file with that name

enter image description here

Tell me how you can launch the port and use the api to access ollama

1

There are 1 answers

16
Kade Youn On BEST ANSWER
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama

Do you have "ollama" file where you are running that command?

-v ollama:/root/.ollama bind mount "ollama" from your current directory to inside container /root/.ollama

If you don't have "ollama" file download from https://ollama.ai/download <- here and place that file to the path where you will run docker command

If you get zipped file, unzip it (the file name has to be same as "ollama")

For example

ls
Ollama-darwin.zip Ollama.app

pwd
/Users/kade93/workspaces/ollama-run

sudo docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
4cb885920b9b7aaa0807434b2b04123574cad27573eecc820adc1f92a3d96fcf

sudo docker exec -it 4cb885920b9b7aaa0807434b2b04123574cad27573eecc820adc1f92a3d96fcf bash
root@4cb885920b9b:/# ls /root/.ollama/
id_ed25519  id_ed25519.pub  models

sudo docker ps
CONTAINER ID   IMAGE           COMMAND               CREATED              STATUS              PORTS                      NAMES
4cb885920b9b   ollama/ollama   "/bin/ollama serve"   About a minute ago   Up About a minute   0.0.0.0:11434->11434/tcp   ollama

Result

Ollama file is not about the problem, can run without download ollama with docker

docker run can be avaliable without downdload ollama at local directory