[GH-ISSUE #14658] ollama docker loses access to nvidia gpu #35252

Closed
opened 2026-04-22 19:38:24 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @ACodingfreak on GitHub (Mar 6, 2026).
Original GitHub issue: https://github.com/ollama/ollama/issues/14658

What is the issue?

As shown in below logs, after sometime ollama running as a docker container is not able to access the underlying NVIDIA GPU as shown below. Eventhough I am able to access the same GPUs by running nvidia-smi from the host machine. If I stop and restart the same ollama container everything work fine as expected.

Relevant log output

$ sudo docker exec -it ollama nvidia-smi
Failed to initialize NVML: Unknown Error

$ nvidia-smi
Thu Mar  5 20:45:27 2026
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.288.01             Driver Version: 535.288.01   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA A30                     Off | 00000000:9B:00.0 Off |                    0 |
| N/A   33C    P0              28W / 165W |      0MiB / 24576MiB |      0%      Default |
|                                         |                      |             Disabled |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+

$ sudo docker exec -it ollama ollama --version
ollama version is 0.15.4

$ sudo docker stop ollama
ollama
$ sudo docker rm ollama
ollama
$sudo docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama
0815be239db8b142db97f6d67571db8f8af99156162777a141c76c226b5d04c7
$ sudo docker exec -it ollama nvidia-smi
Fri Mar  6 04:54:05 2026
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 535.288.01             Driver Version: 535.288.01   CUDA Version: 12.2     |
|-----------------------------------------+----------------------+----------------------+
| GPU  Name                 Persistence-M | Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |         Memory-Usage | GPU-Util  Compute M. |
|                                         |                      |               MIG M. |
|=========================================+======================+======================|
|   0  NVIDIA A30                     Off | 00000000:9B:00.0 Off |                    0 |
| N/A   33C    P0              28W / 165W |      0MiB / 24576MiB |      0%      Default |
|                                         |                      |             Disabled |
+-----------------------------------------+----------------------+----------------------+

+---------------------------------------------------------------------------------------+
| Processes:                                                                            |
|  GPU   GI   CI        PID   Type   Process name                            GPU Memory |
|        ID   ID                                                             Usage      |
|=======================================================================================|
|  No running processes found                                                           |
+---------------------------------------------------------------------------------------+

OS

Docker

GPU

Nvidia

CPU

No response

Ollama version

0.15.4

Originally created by @ACodingfreak on GitHub (Mar 6, 2026). Original GitHub issue: https://github.com/ollama/ollama/issues/14658 ### What is the issue? As shown in below logs, after sometime ollama running as a docker container is not able to access the underlying NVIDIA GPU as shown below. Eventhough I am able to access the same GPUs by running nvidia-smi from the host machine. If I stop and restart the same ollama container everything work fine as expected. ### Relevant log output ```shell $ sudo docker exec -it ollama nvidia-smi Failed to initialize NVML: Unknown Error $ nvidia-smi Thu Mar 5 20:45:27 2026 +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 535.288.01 Driver Version: 535.288.01 CUDA Version: 12.2 | |-----------------------------------------+----------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 NVIDIA A30 Off | 00000000:9B:00.0 Off | 0 | | N/A 33C P0 28W / 165W | 0MiB / 24576MiB | 0% Default | | | | Disabled | +-----------------------------------------+----------------------+----------------------+ +---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | No running processes found | +---------------------------------------------------------------------------------------+ $ sudo docker exec -it ollama ollama --version ollama version is 0.15.4 $ sudo docker stop ollama ollama $ sudo docker rm ollama ollama $sudo docker run -d --gpus=all -v ollama:/root/.ollama -p 11434:11434 --name ollama ollama/ollama 0815be239db8b142db97f6d67571db8f8af99156162777a141c76c226b5d04c7 $ sudo docker exec -it ollama nvidia-smi Fri Mar 6 04:54:05 2026 +---------------------------------------------------------------------------------------+ | NVIDIA-SMI 535.288.01 Driver Version: 535.288.01 CUDA Version: 12.2 | |-----------------------------------------+----------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+======================+======================| | 0 NVIDIA A30 Off | 00000000:9B:00.0 Off | 0 | | N/A 33C P0 28W / 165W | 0MiB / 24576MiB | 0% Default | | | | Disabled | +-----------------------------------------+----------------------+----------------------+ +---------------------------------------------------------------------------------------+ | Processes: | | GPU GI CI PID Type Process name GPU Memory | | ID ID Usage | |=======================================================================================| | No running processes found | +---------------------------------------------------------------------------------------+ ``` ### OS Docker ### GPU Nvidia ### CPU _No response_ ### Ollama version 0.15.4
GiteaMirror added the bug label 2026-04-22 19:38:24 -05:00
Author
Owner
<!-- gh-comment-id:4010081152 --> @rick-github commented on GitHub (Mar 6, 2026): https://github.com/ollama/ollama/blob/main/docs/troubleshooting.mdx#linux-docker
Author
Owner

@ACodingfreak commented on GitHub (Mar 7, 2026):

Thanks for the reply @rick-github

As shown below I am using the latest docker version with cgroupv2 and driver from systemd. The change which you have suggested is to move driver to cgroupfs. I can give a try for the same but curious why it makes a difference ?

$ sudo docker info | grep -i -E 'server version|cgroup|runtimes'
[sudo] password for ipi:
 Server Version: 28.5.1
 Cgroup Driver: systemd
 Cgroup Version: 2
 Runtimes: io.containerd.runc.v2 runc
  cgroupns

<!-- gh-comment-id:4014869310 --> @ACodingfreak commented on GitHub (Mar 7, 2026): Thanks for the reply @rick-github As shown below I am using the latest docker version with cgroupv2 and driver from systemd. The change which you have suggested is to move driver to cgroupfs. I can give a try for the same but curious why it makes a difference ? ``` $ sudo docker info | grep -i -E 'server version|cgroup|runtimes' [sudo] password for ipi: Server Version: 28.5.1 Cgroup Driver: systemd Cgroup Version: 2 Runtimes: io.containerd.runc.v2 runc cgroupns ```
Author
Owner
<!-- gh-comment-id:4016219562 --> @rick-github commented on GitHub (Mar 7, 2026): https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/latest/troubleshooting.html#mitigations-and-workarounds
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#35252