Skip to content

Create .so symlinks for driver libraries in container #326

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Jul 23, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## v1.18.0-rc.2

- Ensure that .so symlinks are created for driver libraries in the container
- Load settings from config.toml file during CDI generation
- Use securejoin to resolve /proc
- Refactor nvml CDI spec generation for consistency
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

## Introduction

The NVIDIA Container Toolkit allows users to build and run GPU accelerated containers. The toolkit includes a container runtime [library](https://github.com/NVIDIA/libnvidia-container) and utilities to automatically configure containers to leverage NVIDIA GPUs.
The NVIDIA Container Toolkit allows users to build and run GPU-accelerated containers. The toolkit includes a container runtime [library](https://github.com/NVIDIA/libnvidia-container) and utilities to automatically configure containers to leverage NVIDIA GPUs.

Product documentation including an architecture overview, platform support, and installation and usage guides can be found in the [documentation repository](https://docs.nvidia.com/datacenter/cloud-native/container-toolkit/overview.html).

Expand Down
2 changes: 0 additions & 2 deletions cmd/nvidia-cdi-hook/commands/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import (
"github.com/urfave/cli/v3"

"github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/chmod"
createsonamesymlinks "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/create-soname-symlinks"
symlinks "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/create-symlinks"
"github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/cudacompat"
disabledevicenodemodification "github.com/NVIDIA/nvidia-container-toolkit/cmd/nvidia-cdi-hook/disable-device-node-modification"
Expand All @@ -36,7 +35,6 @@ func New(logger logger.Interface) []*cli.Command {
symlinks.NewCommand(logger),
chmod.NewCommand(logger),
cudacompat.NewCommand(logger),
createsonamesymlinks.NewCommand(logger),
disabledevicenodemodification.NewCommand(logger),
}
}
Expand Down
166 changes: 0 additions & 166 deletions cmd/nvidia-cdi-hook/create-soname-symlinks/soname-symlinks.go

This file was deleted.

9 changes: 0 additions & 9 deletions cmd/nvidia-ctk-installer/toolkit/toolkit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,15 +98,6 @@ containerEdits:
- libcuda.so.1::/lib/x86_64-linux-gnu/libcuda.so
env:
- NVIDIA_CTK_DEBUG=false
- hookName: createContainer
path: {{ .toolkitRoot }}/nvidia-cdi-hook
args:
- nvidia-cdi-hook
- create-soname-symlinks
- --folder
- /lib/x86_64-linux-gnu
env:
- NVIDIA_CTK_DEBUG=false
- hookName: createContainer
path: {{ .toolkitRoot }}/nvidia-cdi-hook
args:
Expand Down
1 change: 0 additions & 1 deletion cmd/nvidia-ctk/cdi/generate/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ func (m command) build() *cli.Command {
Destination: &opts.ldconfigPath,
Sources: cli.NewValueSourceChain(
cli.EnvVar("NVIDIA_CTK_CDI_GENERATE_LDCONFIG_PATH"),
m.config.ValueFrom("nvidia-container-cli.ldconfig"),
),
},
&cli.StringFlag{
Expand Down
27 changes: 0 additions & 27 deletions cmd/nvidia-ctk/cdi/generate/generate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,15 +102,6 @@ containerEdits:
- --host-driver-version=999.88.77
env:
- NVIDIA_CTK_DEBUG=false
- hookName: createContainer
path: /usr/bin/nvidia-cdi-hook
args:
- nvidia-cdi-hook
- create-soname-symlinks
- --folder
- /lib/x86_64-linux-gnu
env:
- NVIDIA_CTK_DEBUG=false
- hookName: createContainer
path: /usr/bin/nvidia-cdi-hook
args:
Expand Down Expand Up @@ -188,15 +179,6 @@ containerEdits:
- libcuda.so.1::/lib/x86_64-linux-gnu/libcuda.so
env:
- NVIDIA_CTK_DEBUG=false
- hookName: createContainer
path: /usr/bin/nvidia-cdi-hook
args:
- nvidia-cdi-hook
- create-soname-symlinks
- --folder
- /lib/x86_64-linux-gnu
env:
- NVIDIA_CTK_DEBUG=false
- hookName: createContainer
path: /usr/bin/nvidia-cdi-hook
args:
Expand Down Expand Up @@ -274,15 +256,6 @@ containerEdits:
- libcuda.so.1::/lib/x86_64-linux-gnu/libcuda.so
env:
- NVIDIA_CTK_DEBUG=false
- hookName: createContainer
path: /usr/bin/nvidia-cdi-hook
args:
- nvidia-cdi-hook
- create-soname-symlinks
- --folder
- /lib/x86_64-linux-gnu
env:
- NVIDIA_CTK_DEBUG=false
- hookName: createContainer
path: /usr/bin/nvidia-cdi-hook
args:
Expand Down
7 changes: 7 additions & 0 deletions deployments/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ ARG VERSION="N/A"

FROM nvcr.io/nvidia/cuda:12.9.1-base-ubi9 AS build

RUN rm -f /etc/yum.repos.d/cuda.repo && rm -f /etc/ld.so.conf.d/nvidia.conf

RUN dnf install -y \
wget make git gcc \
&& \
Expand Down Expand Up @@ -86,6 +88,8 @@ COPY LICENSE /licenses/
# The debpackages stage is used to extract the contents of deb packages.
FROM nvcr.io/nvidia/cuda:12.9.1-base-ubuntu20.04 AS debpackages

RUN rm -f /etc/apt/sources.list.d/cuda.list

ARG TARGETARCH
ARG PACKAGE_DIST_DEB=ubuntu18.04

Expand All @@ -104,6 +108,9 @@ RUN set -eux; \

# The rpmpackages stage is used to extract the contents of the rpm packages.
FROM nvcr.io/nvidia/cuda:12.9.1-base-ubi9 AS rpmpackages

RUN rm -f /etc/yum.repos.d/cuda.repo && rm -f /etc/ld.so.conf.d/nvidia.conf

RUN dnf install -y cpio

ARG TARGETARCH
Expand Down
3 changes: 0 additions & 3 deletions internal/discover/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ const (
// An UpdateLDCacheHook is the hook used to update the ldcache in the
// container. This allows injected libraries to be discoverable.
UpdateLDCacheHook = HookName("update-ldcache")
// A CreateSonameSymlinksHook is the hook used to ensure that soname symlinks
// for injected libraries exist in the container.
CreateSonameSymlinksHook = HookName("create-soname-symlinks")

defaultNvidiaCDIHookPath = "/usr/bin/nvidia-cdi-hook"
)
Expand Down
7 changes: 1 addition & 6 deletions internal/discover/ldconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,7 @@ func (d ldconfig) Hooks() ([]Hook, error) {
args = append(args, "--folder", f)
}

h := Merge(
d.hookCreator.Create(CreateSonameSymlinksHook, args...),
d.hookCreator.Create(UpdateLDCacheHook, args...),
)

return h.Hooks()
return d.hookCreator.Create(UpdateLDCacheHook, args...).Hooks()
}

// getLibraryPaths extracts the library dirs from the specified mounts
Expand Down
24 changes: 0 additions & 24 deletions internal/discover/ldconfig_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ func TestLDCacheUpdateHook(t *testing.T) {
{
description: "empty mounts",
expectedHooks: []Hook{
{
Lifecycle: "createContainer",
Path: testNvidiaCDIHookPath,
Args: []string{"nvidia-cdi-hook", "create-soname-symlinks"},
Env: []string{"NVIDIA_CTK_DEBUG=false"},
},
{
Lifecycle: "createContainer",
Path: testNvidiaCDIHookPath,
Expand Down Expand Up @@ -80,12 +74,6 @@ func TestLDCacheUpdateHook(t *testing.T) {
},
},
expectedHooks: []Hook{
{
Lifecycle: "createContainer",
Path: testNvidiaCDIHookPath,
Args: []string{"nvidia-cdi-hook", "create-soname-symlinks", "--folder", "/usr/local/lib", "--folder", "/usr/local/libother"},
Env: []string{"NVIDIA_CTK_DEBUG=false"},
},
{
Lifecycle: "createContainer",
Path: testNvidiaCDIHookPath,
Expand All @@ -103,12 +91,6 @@ func TestLDCacheUpdateHook(t *testing.T) {
},
},
expectedHooks: []Hook{
{
Lifecycle: "createContainer",
Path: testNvidiaCDIHookPath,
Args: []string{"nvidia-cdi-hook", "create-soname-symlinks", "--folder", "/usr/local/lib"},
Env: []string{"NVIDIA_CTK_DEBUG=false"},
},
{
Lifecycle: "createContainer",
Path: testNvidiaCDIHookPath,
Expand All @@ -121,12 +103,6 @@ func TestLDCacheUpdateHook(t *testing.T) {
description: "explicit ldconfig path is passed",
ldconfigPath: testLdconfigPath,
expectedHooks: []Hook{
{
Lifecycle: "createContainer",
Path: testNvidiaCDIHookPath,
Args: []string{"nvidia-cdi-hook", "create-soname-symlinks", "--ldconfig-path", testLdconfigPath},
Env: []string{"NVIDIA_CTK_DEBUG=false"},
},
{
Lifecycle: "createContainer",
Path: testNvidiaCDIHookPath,
Expand Down
Loading