Skip to content

Solved: Docker, Nvidia CTK, VGA Device Flag issues. Possible documentation update? #220

@EXP3R1MENT108

Description

@EXP3R1MENT108

Here's an issue I encountered, and solved. I may have misplaced this post and I'm happy to move it over to Discussions if that's more appropriate.

A few days ago I began encountering issues with the Zwift docker after updating my system (apt update, upgrade, and the new Zwift install). I'm still not sure what broke, but this is what happened.

Initially, the Zwift docker would launch, but only display a black screen. I went back to the read me and tried setting the VGA flag, both VGA_DEVICE_FLAG="--device=nvidia.com/gpu=all" and VGA_DEVICE_FLAG="--gpus=all" (I'm running Docker version 27.4.1, build b9d17ea). With the VGA flag set the docker would launch, but the frame rates were abysmal and the cpu fan was running at max speed which led me to believe the GPU was not being used. At this point, I decided to blow away the Zwift and Nvidia container and start fresh. Unfortunately, this didn't solve the problem.

Continuing to troubleshoot, I ran "sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi" which returned "Failed to initialize NVML: Unknown Error". In my mind, this confirmed there was an issue with the docker seeing the GPU. Digging into Nvidia CTK documentation, I found another user with a solution used for similar issues. Following the thread I was able to resolve my issue doing the following:

With the help of https://bobcares.com/blog/docker-failed-to-initialize-nvml-unknown-error/ !

I used the second part of “Method 1”:

Modify the nvidia-container configuration:
In the file, /etc/nvidia-container-runtime/config.toml
set the parameter: no-cgroups = false

After that, restart docker:
sudo systemctl restart docker

Run the Nvidia CTK sample workload:
sudo docker run --rm --runtime=nvidia --gpus all ubuntu nvidia-smi

Confirmed nvidia-smi displayed as expected.

Next, I set the VGA Device Flag but instead of using one of the aforementioned flags, I used the following: VGA_DEVICE_FLAG="--runtime=nvidia --gpus=all".

And with that, Zwift now recognizes my GPU and running 4k resolution is running smother than it ever has, even when I was running at 1080p.

Perhaps VGA_DEVICE_FLAG="--runtime=nvidia --gpus=all" should be listed as a possible flag.

For reference:

Sat Sep 27 12:42:16 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.82.09 Driver Version: 580.82.09 CUDA Version: 13.0 |
+-----------------------------------------+------------------------+----------------------+
| 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 Quadro RTX 4000 with Max... Off | 00000000:01:00.0 On | N/A |
| N/A 45C P8 10W / 50W | 339MiB / 8192MiB | 1% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| 0 N/A N/A 2891 G /usr/bin/gnome-shell 171MiB |
| 0 N/A N/A 4275 G /usr/bin/gnome-text-editor 44MiB |
| 0 N/A N/A 4396 G /usr/bin/Xwayland 3MiB |
| 0 N/A N/A 4481 G ...7754cd31363935ecd5073628f71dc 107MiB |
+-----------------------------------------------------------------------------------------+

In Docker:

Sat Sep 27 16:44:27 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 580.82.09 Driver Version: 580.82.09 CUDA Version: 13.0 |
+-----------------------------------------+------------------------+----------------------+
| 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 Quadro RTX 4000 with Max... Off | 00000000:01:00.0 On | N/A |
| N/A 44C P8 10W / 50W | 349MiB / 8192MiB | 0% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions