Skip to content

cdi

Repo box/github.com/opencharly/layer-cdi:v2026.329.2058

The CDI runtime contract for GPU images, and the ONLY layer that owns it.

A GPU container does not get its driver from the image: the kernel module is host-global, so the driver user-space must come from the host, injected per container (--device nvidia.com/gpu=all, via the NVIDIA container toolkit’s CDI spec and its runtime hook). An image that bakes its own driver user-space does not merely duplicate that — it WINS the SONAME resolution, because the injection mounts the host’s VERSIONED files (libnvidia-ml.so.615.78.08, …) and the image’s own newer copy (libnvidia-ml.so.620.70.06) stays visible next to them, so libnvidia-ml.so.1 resolves to the baked one. nvidia-smi then exits 18 with “Driver/library version mismatch”, and every consumer that estimates free memory through NVML — ollama among them — silently degrades to CPU while answering normally. Measured on CachyOS, October 2026: host module 615.78.08 against a baked userspace 620.70.06, ollama offloading 0/29 layers. opencharly/layer-cuda#21.

So this layer does exactly three things, and every GPU image composes it:

  1. ENSURES no host-coupled driver user-space or nvidia* binary is baked. The target is to install nothing that carries them; layer-cuda’s strip is the current TRANSITIONAL enforcement while the toolkit still comes from a distro package (opencharly/layer-cuda#39 tracks the driver-free source that retires it). Measured on Arch/CachyOS: pacman -S cuda pulls opencl-nvidia (three driver files), NOT nvidia-utils — measure the closure per distro rather than assuming it.
  2. PROVES, at build time and again at check time, that none of them remain — including the versioned files, because the CDI create-symlinks hook re-creates each SONAME link from whatever versioned file it finds.
  3. PROVES, at check time, that the container actually resolved the INJECTED driver and that its version equals the running kernel module’s.

What this layer deliberately does NOT remove: the Vulkan/OpenCL ICD files. They name a SONAME (libGLX_nvidia.so.0), not a version, so the link the injection creates satisfies them — which is why they are part of the contract rather than a violation of it.

This candy’s plan: — the runnable spec charly check executes against a live deployment. check: steps are idempotent probes; run: steps change state.

Intent Step
run provide the OpenCL ICD file the toolkit’s vendored driver no longer ships
run the OpenCL ICD file names the injected SONAME
run no host-coupled driver library is baked — the injection is the only provider
run no host-coupled nvidia binary is baked — the injection is the only provider
check the container resolved the INJECTED host driver, and its version equals the running kernel module’s