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

Conversation

jroddev
Copy link

@jroddev jroddev commented Jan 29, 2025

WIP for using podman-compose instead of docker compose with the Ollama API docs.

Needs someone else to verify before merging these updates. I have only tested on my Aurora install with Nvidia GPU.

Nvidia GPU passthrough seems to need sudo until this bug is fixed containers/podman#19338

Make some changes required to use podman instead of docker
docs/ai.md Outdated
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

docs/ai.md Outdated
volumes:
- ./ollama_v:/root/.ollama: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: []

@castrojo
Copy link
Member

We could also just put a quadlet in there and tell people to paste it into the right file? I'm thinking, if we're going podman, we should go full podman/quadlet which is what they prefer.

We should also leave the docker example there too, if someone needs to get something done and they need ollama they shouldn't have to learn podman that same time, so offering both feels great. What do you think?

@jroddev
Copy link
Author

jroddev commented Jan 30, 2025

@castrojo I think that makes sense. I suspect that it will still need to run as root, but I'll give it a try and report back.
Also LMStudio AppImage worked out of the box

split podman from the docker section, also add a quadlet version
ContainerName=ollama
AutoUpdate=yes
PublishPort=11434:11434
Volume=./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.

Not sure what the volume path should be in the quadlet

@jroddev
Copy link
Author

jroddev commented Jan 30, 2025

OK so the quadlet kind of works.

  • Starts fine under --user with ~/.local/share/systemd/ollama.container
  • nvidia gpu is working (without sudo, --system)
  • I still needed to brew install ollama on the host to get the cli frontend (or you could exec into the container)
  • ollama is picking up existing models from my system (I think from ~/.ollama). I'm not sure how since it's not mounted into the container. Maybe the frontend is doing it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docker-compose: Passing gpu with driver: cdi is not supported
2 participants