Docker not recognizing vulkan GPU
selmiskr opened this issue · comments
Windows build number:
Microsoft Windows [Version 10.0.22631.3296]
Your Distribution version:
Ubuntu 22.04
Your WSL versions:
2.0.14.0
Steps to reproduce:
GIVEN following Dockerfile
FROM nvidia/cuda:12.3.2-base-ubuntu22.04
ENV NVIDIA_VISIBLE_DEVICES all
ENV NVIDIA_DRIVER_CAPABILITIES all
# DEPENDENCIES
RUN apt update && apt install -y software-properties-common
RUN add-apt-repository ppa:kisak/kisak-mesa && apt update
RUN apt update && apt install -y \
libatomic1 \
libxi6 \
libxrandr2 \
libxt6 \
libegl1 \
libglu1-mesa \
libgomp1 \
libsm6 \
libvulkan1 \
mesa-vulkan-drivers \
vulkan-tools \
sudo && rm -rf /var/lib/apt/lists/*
WORKDIR /etc/vulkan/icd.d
RUN ls -l
RUN sudo touch nvidia_icd.json
RUN printf "{ \"file_format_version\" : \"1.0.0\", \"ICD\": { \"library_path\": \"libGLX_nvidia.so.0\", \"api_version\" : \"$(dpkg -s libvulkan1 | grep -oP 'Version: [0-9|\.]+' | grep -oP '[0-9|\.]+')\" } }" | sudo tee nvidia_icd.json
BUILD Dockerfile
docker build `
--no-cache `
--progress=plain `
-t vulkan `
-f DOCKERFILE
RUN with
docker run `
--rm `
--privileged `
--gpus all `
-it `
vulkan `
vulkaninfo --summary
WSL logs:
No response
WSL dumps:
No response
Expected behavior:
Summary giving me the physical GPU. If I run within WSL2 I get the following:
I expect this also inside docker.
Actual behavior:
I only get the CPU for vulkan. See screenshot.
Running nvidia-smi inside the docker container gives.
So the GPU is recognized within docker but vulkan is not selecting it. It seems that the icd.d json is also missing inside WSL and therefore vulkan within the docker container cannot map to it and does not recognize the GPU