vaggeliskls / windows-in-docker-container

Deploy and manage a Windows OS (x64) seamlessly using Vagrant VM, libvirt, and docker-compose. This innovative approach integrates smoothly into existing workflows, providing an efficient way of containerizing Windows OS for better resource allocation and convenience.
MIT License
70 stars 12 forks source link

GPUs issue #6

Open PeRcHiK31 opened 12 months ago

PeRcHiK31 commented 12 months ago

Hey,

I want to thank you for this repository, it's very useful and made my life easier, but I'm wondering if I can connect a GPU to Windows? I've been trying to do this for 3 days now and nothing is working yet.

I tried to add PCI parameters to Vagrantfile, tried to edit the grub config, add packages and dependencies, enabled virtualization on the machine itself, tried to use --gpus all and also --runtime-nvidia but every time I either got an error or the GPU was not available.

I would be grateful if you know the solution to the problem and would probably add it to the repository.

Thanks in advance.

vaggeliskls commented 12 months ago

Thank you for your valuable feedback.

The feature of GPU hardware acceleration is something that I've found would be especially useful for my use cases. I've conducted some research and attempted to implement it, but to no avail.

Here are the steps I've taken so far:

  1. Installed the nvidia-container-toolkit on the host machine.
  2. Tried enabling GPU inside Docker/Docker-compose by utilizing either the runtime: nvidia command, or by using the following code:
    deploy:
       resources:
          reservations:
            devices:
               - driver: nvidia
                 count: 1
                 capabilities: [gpu]
  3. Found that the GPU hardware acceleration is usable inside the Ubuntu 22.04 container, but unfortunately, it's not accessible inside the Vagrant Windows VM.
  4. Experimented with GPU passthrough and IOMMU.
  5. Looked into using various libvirt options as well.

However, this investigation was rather brief due to time constraints. I'm going to delve deeper when I can, but any advice or insights into this matter would be highly appreciated.