Maybe this helps:
Docker Build with NVIDIA GPU on Windows
This guide explains how to resolve connectivity and GPG key issues when building Docker images on Windows with NVIDIA GPU support.
Prerequisites
- Internet Access: Ensure your machine has a stable internet connection.
- NVIDIA GPU Driver: Install the latest GPU drivers from NVIDIA’s website.
- Docker Desktop: Install Docker Desktop with WSL 2 integration.
- WSL 2: Set up Windows Subsystem for Linux 2.
- NVIDIA Container Toolkit: Install the NVIDIA Container Toolkit for GPU support.
Steps to Resolve GPG Key Error
1. Verify Internet Access
Open a Command Prompt or PowerShell and check connectivity to NVIDIA:
curl https://nvidia.github.io -v
If this fails, check your network settings, firewall, or proxy.
2. Configure Docker for NVIDIA GPUs on Windows
-
Install NVIDIA GPU Driver:
-
Install NVIDIA Container Toolkit in WSL:
Replace ubuntu20.04
with your version of Ubuntu if different.
3. Fix GPG Key Issues in WSL
Manually add the GPG key and NVIDIA repository:
curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit.gpg
curl -fsSL https://nvidia.github.io/libnvidia-container/stable/ubuntu20.04/libnvidia-container.list | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list
sudo apt-get update
sudo apt-get install -y nvidia-container-toolkit
4. Configure Proxy for Docker (If Applicable)
If you’re behind a proxy, configure Docker Desktop to use proxy settings:
- Open Docker Desktop and go to Settings → Resources → Proxies.
- Set the HTTP Proxy and HTTPS Proxy fields.
Alternatively, add proxy settings to your Docker config.json
:
{
"proxies": {
"default": {
"httpProxy": "http://proxy-server:port",
"httpsProxy": "http://proxy-server:port"
}
}
}
Save this file to:
C:\Users\<YourUsername>\.docker\config.json
Restart Docker Desktop after making these changes.
5. Use an NVIDIA-Compatible Base Image
Ensure your Dockerfile uses an NVIDIA-compatible base image:
FROM nvidia/cuda:12.0-runtime-ubuntu22.04
6. Retry the Build
Run the Docker build command from PowerShell or WSL:
docker build -t ollama-gpu .
7. Debugging Docker Issues on Windows
If issues persist, check the logs:
Additional Notes
- Ensure that your Docker Desktop installation is configured to use WSL 2.
- Verify that the
nvidia-smi
command works in WSL to confirm GPU availability.
- Test connectivity to
nvidia.github.io
to ensure proper access.
This guide should help resolve GPG key and connectivity issues during Docker builds on Windows with NVIDIA GPU support.