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

Draft: Ollama API with Podman Compose #93

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion docs/ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@

Since Alpaca doesn't expose any API, if you need other applications than Alpaca to interact with your ollama instance (for example an IDE) you should consider installing it [in a docker container](https://hub.docker.com/r/ollama/ollama).

To do so, first configure docker to use the nvidia drivers (that come preinstalled with Bluefin) with:
To do so, first configure docker to use the nvidia drivers (that come preinstalled with Bluefin).

```bash
# Only required for Docker, Not required for Podman
sudo nvidia-ctk runtime configure --runtime=docker
sudo systemctl restart docker
```

Then, choose a folder where to install the ollama container (for example `~/Containers/ollama`) and inside it create a new file named `docker-compose.yaml` with the following content:

```yaml
# docker compose
---
services:
ollama:
Expand All @@ -45,10 +47,38 @@
- gpu
```

```yaml
# podman-compose
---
services:
ollama:
image: ollama/ollama
container_name: ollama
restart: unless-stopped
ports:
- 11434:11434
volumes:
- ./ollama_v:/root/.ollama:z
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Permission denied in podman without :z

devices:
- nvidia.com/gpu=all
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might work with docker-compose as well. If so we can probably unify the 2 blocks (:z worked with docker-compose)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does not work for docker

Error response from daemon: could not select device driver "cdi" with capabilities: []

deploy:
resources:
reservations:
devices:
- capabilities:
- gpu

```


Check notice on line 73 in docs/ai.md

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

docs/ai.md#L73

Expected: 1; Actual: 2
Finally, open a terminal in the folder containing the file just created and start the container with

```bash
docker compose up -d
# or
sudo podman-compose up -d
# podman needs to be run as root for nvidia gpu passthrough until this is fixed
# https://github.com/containers/podman/issues/19338
```

and your ollama instance should be up and running at `http://127.0.0.1:11434`!
Expand Down