mirror of
https://github.com/NVIDIA/nvidia-container-toolkit
synced 2025-06-26 18:18:24 +00:00
Add create-soname-symlinks hook
This change adds a create-soname-symlinks hook that can be used to ensure that the soname symlinks for injected libraries exist in a container. This is done by calling ldconfig -n -N for the directories containing the injected libraries. This also ensures that libcuda.so is present in the ldcache when the update-ldcache hook is run. Signed-off-by: Evan Lezar <elezar@nvidia.com>
This commit is contained in:
@@ -235,4 +235,26 @@ var _ = Describe("docker", Ordered, ContinueOnFailure, func() {
|
||||
Expect(output).To(Equal("ModifyDeviceFiles: 0\n"))
|
||||
})
|
||||
})
|
||||
|
||||
When("A container is run using CDI", Ordered, func() {
|
||||
BeforeAll(func(ctx context.Context) {
|
||||
_, _, err := runner.Run("docker pull ubuntu")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
})
|
||||
|
||||
It("should include libcuda.so in the ldcache", func(ctx context.Context) {
|
||||
ldcacheOutput, _, err := runner.Run("docker run --rm -i --runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=runtime.nvidia.com/gpu=all ubuntu bash -c \"ldconfig -p | grep 'libcuda.so'\"")
|
||||
Expect(err).ToNot(HaveOccurred())
|
||||
Expect(ldcacheOutput).ToNot(BeEmpty())
|
||||
|
||||
ldcacheLines := strings.Split(ldcacheOutput, "\n")
|
||||
var libs []string
|
||||
for _, line := range ldcacheLines {
|
||||
parts := strings.SplitN(line, " (", 2)
|
||||
libs = append(libs, strings.TrimSpace(parts[0]))
|
||||
}
|
||||
|
||||
Expect(libs).To(ContainElements([]string{"libcuda.so", "libcuda.so.1"}))
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user