๊ธฐ์กด์๋ systemd๋ก ํจํค์ง๋ฅผ ์ค์นํ ์ฌ์ฉํ๋ค. docker๋ก ์ฌ์ฉํด๋ณด์.
docker run -d \
-p 21434:11434 \
--name ollama \
ollama/ollama
์ธ๋ถ ์คํ ํฌํธ๋ ์ ๋นํ ๋ฐ๊พธ์.
docker exec -it ollama bash
ollama run llama2
์ ๋๋ค.
api๋ก ํ
์คํธ (on host)
curl -X POST http://localhost:21434/api/generate -d '{
"model": "llama2",
"prompt":"Why is the sky blue?"
}'
version: '3.8'
services:
ollama:
image: ollama/ollama
container_name: ollama
ports:
- 21434:11434
restart: unless-stopped
docker exec -it ollama bash
ollama run llama2
curl -X POST http://localhost:21434/api/generate -d '{
"model": "llama2",
"prompt":"Why is the sky blue?"
}'
docker๋ฅผ ์ง์ฐ๊ณ ๋ค์ ์์ฑํ๋ฉด ๋ชจ๋ธ์ ๋ค์ ๋ค์ดํด์ผํ๋ ๋ฌธ์
๋ง์ดํธ๋ฅผ ํด์ ํด๊ฒฐํ์.
docker run -d \
-v ~/.ollama:/root/.ollama \
-p 21434:11434 \
--name ollama \
ollama/ollama
version: '3.8'
services:
ollama:
image: ollama/ollama
container_name: ollama
ports:
- 21434:11434
restart: unless-stopped
volumes:
- ~/.ollama:/root/.ollama
ํ ๋๋ ํ ๋ฆฌ์ .ollama ํด๋์ ๋ง์ดํธํด์ ์ด์ docker๋ฅผ ์ง์ฐ๊ณ ๋ค์ ์์ฑํด๋ ๋ชจ๋ธ์ ๋ค์ ๋ค์ด๋ฐ์ง ์๋๋ค.
docker exec -it ollama bash
root@c4efa0c84132:/# ollama list
NAME ID SIZE MODIFIED
llama2-uncensored:70b-chat bdd0ec2f5ec5 38 GB 25 hours ago
llama2-uncensored:7b-chat 44040b922233 3.8 GB 24 hours ago
mistral:latest 1ab49bc0b6a8 4.1 GB 26 hours ago