Incus - Enable GPU Passthru for Incus Container

02/17/2026, Tue
Categories: #containers

Host GPU Access

To get the most out of your incus container, you can opt to enable the use of the host gpu through the container. It is recommended that you use a linux container distro that matches your host for better kernel compatibility.

First, check if gpu is enabled

sudo incus config device list <container_name>

It should show a gpu entry. Then get the preliminary information from the host. Note the pci address that you want to pass through

sudo incus info --resources | grep  "GPU" -A 20

It is the value after the colons on the 'PCI address' line. On the host, check the gid using

getent group video
# sample Output: video:x:985:

getent group render
# sample Output: render:x:989:

Add the GPU. The primary GPU (gpu or devices like /dev/dri/card0), use the video GID:

incus config device add <container_name> mygpu gpu pci=<PCI address> [gputype=physical]
sudo incus config device add opensuse gpu gpu pci=0000:0b:00.0 gid=985

If GPU passthrough is enabled, you should see device nodes like card0 and renderD128 (these represent the GPU device)

Restart the container

sudo incus restart <container-name>

Enter the container and check

ls -al /dev/dri/

You should see entries like card0 and renderD128. Add user groups permissions for the container to access the render and video groups.

Create the user in the container

sudo incus exec arch -- useradd -m -s /bin/bash <desired‑username>

Set a password

sudo incus exec arch -- passwd <desired‑username>

Adjust permissions if needed

sudo incus exec <container_name> -- usermod -a -G render,video <username>

Additional verification inside the container

lspci -nnk | grep -EA3 'VGA|3D'

You can test out if the gpu is detected and enabled for use if you ran a ffmpeg encoding test.

Copy the video file into the incus container.

incus file push -r host/path <instance_name>/file/path

Use ffmpeg to encode the video.

ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i "a-video.webm" -vf 'scale_vaapi=format=nv12' -c:v h264_vaapi -f mp4 output.mp4