Since musl (used in Alpine) doesn't use ldconfig or the ldcache, the current mechansim to ensure that the injected libraries are detectable does not work in Alpine containers.
We could update the update-ldcache and enable-cuda-compat hooks to create / modify /etc/ld-musl-$(arch -m).path in addition to creating the ld.so.conf.d files.
See https://wiki.musl-libc.org/faq
To validate a possible fix:
- Start an alpine container requesting gpus:
docker run --rm -ti --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all alpine
- Install gcompat since we KNOW that nvidia-smi uses glibc:
apk add --no-cache gcompat
(without this we get the following message when running nvidia-smi: /bin/sh: nvidia-smi: not found)
- Create a .path file with the expected contents:
cat /etc/ld.so.conf.d/* >> /etc/ld-musl-$(arch -m).path
- Run nvidia-smi:
nvidia-smi -L
GPU 0: Orin (nvgpu) (UUID: 1833c8b5-9aa0-5382-b784-68b7e77eb185)
Since
musl(used in Alpine) doesn't use ldconfig or the ldcache, the current mechansim to ensure that the injected libraries are detectable does not work in Alpine containers.We could update the
update-ldcacheandenable-cuda-compathooks to create / modify/etc/ld-musl-$(arch -m).pathin addition to creating theld.so.conf.dfiles.See https://wiki.musl-libc.org/faq
To validate a possible fix: