Skip to content

Commit 8cc0ee2

Browse files
committed
Doc container usage and workaround for nvidia errors
1 parent d5eec16 commit 8cc0ee2

File tree

3 files changed

+92
-2
lines changed

3 files changed

+92
-2
lines changed

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* [Importing models](./import.md)
77
* [Linux Documentation](./linux.md)
88
* [Windows Documentation](./windows.md)
9-
* [Docker Documentation](https://hub.docker.com/r/ollama/ollama)
9+
* [Docker Documentation](./docker.md)
1010

1111
### Reference
1212

docs/docker.md

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# Ollama Docker image
2+
3+
### CPU only
4+
5+
```bash
6+
docker run -d -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
7+
```
8+
9+
### Nvidia GPU
10+
Install the [NVIDIA Container Toolkit](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/install-guide.html#installation).
11+
12+
#### Install with Apt
13+
1. Configure the repository
14+
```bash
15+
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey \
16+
| sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg
17+
curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list \
18+
| sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' \
19+
| sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
20+
sudo apt-get update
21+
```
22+
2. Install the NVIDIA Container Toolkit packages
23+
```bash
24+
sudo apt-get install -y nvidia-container-toolkit
25+
```
26+
27+
#### Install with Yum or Dnf
28+
1. Configure the repository
29+
30+
```bash
31+
curl -s -L https://nvidia.github.io/libnvidia-container/stable/rpm/nvidia-container-toolkit.repo \
32+
| sudo tee /etc/yum.repos.d/nvidia-container-toolkit.repo
33+
```
34+
35+
2. Install the NVIDIA Container Toolkit packages
36+
37+
```bash
38+
sudo yum install -y nvidia-container-toolkit
39+
```
40+
41+
#### Configure Docker to use Nvidia driver
42+
```
43+
sudo nvidia-ctk runtime configure --runtime=docker
44+
sudo systemctl restart docker
45+
```
46+
47+
#### Start the container
48+
49+
```bash
50+
docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
51+
```
52+
53+
### AMD GPU
54+
55+
To run Ollama using Docker with AMD GPUs, use the `rocm` tag and the following command:
56+
57+
```
58+
docker run -d --device /dev/kfd --device /dev/dri -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama:rocm
59+
```
60+
61+
### Run model locally
62+
63+
Now you can run a model:
64+
65+
```
66+
docker exec -it ollama ollama run llama3
67+
```
68+
69+
### Try different models
70+
71+
More models can be found on the [Ollama library](https://ollama.com/library).

docs/troubleshooting.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,23 @@ curl -fsSL https://ollama.com/install.sh | OLLAMA_VERSION="0.1.29" sh
8282
If your system is configured with the "noexec" flag where Ollama stores its
8383
temporary executable files, you can specify an alternate location by setting
8484
OLLAMA_TMPDIR to a location writable by the user ollama runs as. For example
85-
OLLAMA_TMPDIR=/usr/share/ollama/
85+
OLLAMA_TMPDIR=/usr/share/ollama/
86+
87+
## Container fails to run on NVIDIA GPU
88+
89+
Make sure you've set up the conatiner runtime first as described in [docker.md](./docker.md)
90+
91+
Sometimes the container runtime can have difficulties initializing the GPU.
92+
When you check the server logs, this can show up as various error codes, such
93+
as "3" (not initialized), "46" (device unavailable), "100" (no device), "999"
94+
(unknown), or others. The following troubleshooting techniques may help resolve
95+
the problem
96+
97+
- Is the uvm driver not loaded? `sudo nvidia-modprobe -u`
98+
- Try reloading the nvidia_uvm driver - `sudo rmmod nvidia_uvm` then `sudo modprobe nvidia_uvm`
99+
- Try rebooting
100+
- Make sure you're running the latest nvidia drivers
101+
102+
If none of those resolve the problem, gather additional information and file an issue:
103+
- Set `CUDA_ERROR_LEVEL=50` and try again to get more diagnostic logs
104+
- Check dmesg for any errors `sudo dmesg | grep -i nvrm` and `sudo dmesg | grep -i nvidia`

0 commit comments

Comments
 (0)