If you're working with machine learning, hardware acceleration, or high-performance computing on Linux, leveraging the system's GPU inside Docker containers can significantly improve performance. Intel GPUs can be utilized effectively - especially for workloads using OpenCL or Intel oneAPI. This tutorial explains how to pass Intel GPU to Docker container on Linux.
To expose the Intel GPU to the Docker container, you'll need to pass the /dev/dri
device into the container using the --device
option:
docker run -it --rm --device /dev/dri <image_name>
For example, the following command runs Docker container with oneAPI runtime:
docker run -it --rm --device /dev/dri intel/oneapi-runtime
To verify that the Intel GPU is detected, install clinfo
inside the container:
apt update && apt install -y clinfo
Now, run:
clinfo -l
You should see output like this:
Platform #1: Intel(R) OpenCL Graphics
`-- Device #0: Intel(R) UHD Graphics
This confirms that the container can access the Intel GPU.
Leave a Comment
Cancel reply