1
- FROM nvcr.io/nvidia/cuda:12.9.1-base-ubi8 AS license
2
-
3
- # Build nvidia-container-runtime binary
4
- FROM golang:1.24.4 AS build-runtime
5
-
6
- WORKDIR /go/bin/nvidia-container-runtime
7
- COPY nvidia-container-runtime .
8
- RUN go mod vendor
9
- RUN go install -v .
10
-
11
- # Build driver image
12
- FROM ubuntu:22.04
13
-
14
- RUN dpkg --add-architecture i386 && \
15
- apt-get update && apt-get install -y --no-install-recommends \
16
- apt-transport-https \
17
- apt-utils \
18
- bc \
19
- binutils \
20
- build-essential \
21
- ca-certificates \
22
- curl \
23
- gnupg2 \
24
- jq \
25
- kmod \
26
- libc6:i386 \
27
- libelf-dev \
28
- libssl-dev \
29
- kmod \
30
- software-properties-common && \
31
- rm -rf /var/lib/apt/lists/*
32
-
33
- RUN echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic main" > /etc/apt/sources.list && \
34
- echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-updates main" >> /etc/apt/sources.list && \
35
- echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ bionic-security main" >> /etc/apt/sources.list && \
36
- usermod -o -u 0 -g 0 _apt
37
-
38
- RUN curl -fsSL -o /usr/local/bin/donkey https://github.com/3XX0/donkey/releases/download/v1.1.0/donkey && \
39
- curl -fsSL -o /usr/local/bin/extract-vmlinux https://raw.githubusercontent.com/torvalds/linux/master/scripts/extract-vmlinux && \
40
- chmod +x /usr/local/bin/donkey /usr/local/bin/extract-vmlinux
1
+ ARG FEDORA_VERSION=39
2
+
3
+ # Stage 1
4
+ FROM nvcr.io/nvidia/cuda:12.6.1-base-ubi8 AS build
5
+
6
+ ARG TARGETARCH
7
+
8
+ SHELL ["/bin/bash" , "-c" ]
9
+
10
+ RUN dnf install -y git wget
11
+
12
+ ENV GOLANG_VERSION=1.22.7
13
+
14
+ # download appropriate binary based on the target architecture for multi-arch builds
15
+ RUN OS_ARCH=${TARGETARCH/x86_64/amd64} && OS_ARCH=${OS_ARCH/aarch64/arm64} && \
16
+ curl https://dl.google.com/go/go${GOLANG_VERSION}.linux-${OS_ARCH}.tar.gz \
17
+ | tar -C /usr/local -xz
18
+
19
+ ENV PATH=/usr/local/go/bin:$PATH
20
+
21
+ WORKDIR /work
22
+
23
+ RUN git clone https://github.com/NVIDIA/gpu-driver-container driver && \
24
+ cd driver/vgpu/src && \
25
+ go build -o vgpu-util && \
26
+ mv vgpu-util /work
27
+
28
+ # Stage 2
29
+ FROM fedora:${FEDORA_VERSION}
30
+
31
+ LABEL org.opencontainers.image.source https://github.com/maastrichtu-library/dsri-nvidia-driver
32
+
33
+ ARG TARGETARCH
34
+ ENV TARGETARCH=$TARGETARCH
35
+
36
+ ARG KERNEL_TYPE
37
+ ENV KERNEL_TYPE=$KERNEL_TYPE
38
+
39
+ SHELL ["/bin/bash" , "-c" ]
41
40
42
- # ARG BASE_URL=http://us.download.nvidia.com/XFree86/Linux-x86_64
43
41
ARG BASE_URL=https://us.download.nvidia.com/tesla
44
- ARG DRIVER_VERSION=450.80.02
42
+ ENV BASE_URL=${BASE_URL}
43
+ ARG DRIVER_VERSION=570.158.01
45
44
ENV DRIVER_VERSION=$DRIVER_VERSION
46
45
47
- # Install the userspace components and copy the kernel module sources.
48
- RUN cd /tmp && \
49
- curl -fSsl -O $BASE_URL/$DRIVER_VERSION/NVIDIA-Linux-x86_64-$DRIVER_VERSION.run && \
50
- sh NVIDIA-Linux-x86_64-$DRIVER_VERSION.run -x && \
51
- cd NVIDIA-Linux-x86_64-$DRIVER_VERSION* && \
52
- ./nvidia-installer --silent \
53
- --no-kernel-module \
54
- --install-compat32-libs \
55
- --no-nouveau-check \
56
- --no-nvidia-modprobe \
57
- --no-rpms \
58
- --no-backup \
59
- --no-check-for-alternate-installs \
60
- --no-libglx-indirect \
61
- --no-install-libglvnd \
62
- --x-prefix=/tmp/null \
63
- --x-module-path=/tmp/null \
64
- --x-library-path=/tmp/null \
65
- --x-sysconfig-path=/tmp/null && \
66
- mkdir -p /usr/src/nvidia-$DRIVER_VERSION && \
67
- mv LICENSE mkprecompiled kernel /usr/src/nvidia-$DRIVER_VERSION && \
68
- sed '9,${/^\( kernel\| LICENSE\) /!d}' .manifest > /usr/src/nvidia-$DRIVER_VERSION/.manifest && \
69
- rm -rf /tmp/*
70
-
71
- # Install and configure nvidia-container-runtime
72
- ENV NVIDIA_VISIBLE_DEVICES void
73
-
74
- COPY --from=build-runtime /go/bin/nvidia-container-runtime /usr/bin/nvidia-container-runtime
75
-
76
- RUN curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | apt-key add - && \
77
- distribution=$(. /etc/os-release;echo $ID$VERSION_ID) && \
78
- curl -s -L https://nvidia.github.io/nvidia-container-runtime/$distribution/nvidia-container-runtime.list | tee /etc/apt/sources.list.d/nvidia-container-runtime.list && \
79
- apt-get update && \
80
- apt-get install -y nvidia-container-runtime-hook && \
81
- cd /usr && ln -s lib/x86_64-linux-gnu lib64 && cd - && \
82
- sed -i 's/^#root/root/; s;@/sbin/ldconfig.real;@/run/nvidia/driver/sbin/ldconfig.real;' /etc/nvidia-container-runtime/config.toml
46
+ # Arg to indicate if driver type is either of passthrough/baremetal or vgpu
47
+ ARG DRIVER_TYPE=passthrough
48
+ ENV DRIVER_TYPE=$DRIVER_TYPE
49
+ ARG VGPU_LICENSE_SERVER_TYPE=NLS
50
+ ENV VGPU_LICENSE_SERVER_TYPE=$VGPU_LICENSE_SERVER_TYPE
51
+ # Enable vGPU version compability check by default
52
+ ARG DISABLE_VGPU_VERSION_CHECK=true
53
+ ENV DISABLE_VGPU_VERSION_CHECK=$DISABLE_VGPU_VERSION_CHECK
54
+ # Avoid dependency of container-toolkit for driver container
55
+ ENV NVIDIA_VISIBLE_DEVICES=void
56
+
57
+ # Utils, download plugin, and patch package
58
+ RUN dnf install -y util-linux 'dnf-command(download)'
59
+ RUN dnf install -y patch
60
+
61
+ ADD install.sh /tmp/
62
+
63
+ RUN NVIDIA_GPGKEY_SUM=d0664fbbdb8c32356d45de36c5984617217b2d0bef41b93ccecd326ba3b80c87 && \
64
+ OS_ARCH=${TARGETARCH/amd64/x86_64} && OS_ARCH=${OS_ARCH/arm64/sbsa} && \
65
+ curl -fsSL "https://developer.download.nvidia.com/compute/cuda/repos/rhel8/$OS_ARCH/D42D0685.pub" | sed '/^Version/d' > /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA && \
66
+ echo "$NVIDIA_GPGKEY_SUM /etc/pki/rpm-gpg/RPM-GPG-KEY-NVIDIA" | sha256sum -c --strict -
67
+
68
+ RUN sh /tmp/install.sh depinstall && \
69
+ curl -fsSL -o /usr/local/bin/donkey https://github.com/3XX0/donkey/releases/download/v1.1.0/donkey && \
70
+ curl -fsSL -o /usr/local/bin/extract-vmlinux https://raw.githubusercontent.com/torvalds/linux/master/scripts/extract-vmlinux && \
71
+ chmod +x /usr/local/bin/donkey /usr/local/bin/extract-vmlinux && \
72
+ ln -s /sbin/ldconfig /sbin/ldconfig.real
73
+
74
+ ADD drivers drivers/
75
+
76
+ # Fetch the installer automatically for passthrough/baremetal types
77
+ # RUN echo $BASE_URL/$DRIVER_VERSION/NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run
78
+ RUN if [ "$DRIVER_TYPE" != "vgpu" ]; then \
79
+ cd drivers && \
80
+ DRIVER_ARCH=${TARGETARCH/amd64/x86_64} && DRIVER_ARCH=${DRIVER_ARCH/arm64/aarch64} && \
81
+ curl -fSsl -O $BASE_URL/$DRIVER_VERSION/NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run && \
82
+ chmod +x NVIDIA-Linux-$DRIVER_ARCH-$DRIVER_VERSION.run; fi
83
+
84
+ # ******************************************************************************
85
+ # REMOVED FABRIC MANAGER RHEL WORK FOR NOW - HAVEN'T ATTEMPTED INCLUSION
86
+ # ******************************************************************************
87
+ # Install fabric-manager packages
88
+ # RUN if [ "$DRIVER_TYPE" != "vgpu" ] && [ "$TARGETARCH" != "arm64" ]; then \
89
+ # versionArray=(${DRIVER_VERSION//./ }); \
90
+ # DRIVER_BRANCH=${versionArray[0]}; \
91
+ # if [ ${versionArray[0]} -ge 470 ] || ([ ${versionArray[0]} == 460 ] && [ ${versionArray[1]} -ge 91 ]); then \
92
+ # fmPackage=nvidia-fabric-manager-${DRIVER_VERSION}-1; \
93
+ # else \
94
+ # fmPackage=nvidia-fabricmanager-${DRIVER_BRANCH}-${DRIVER_VERSION}-1; \
95
+ # fi; \
96
+ # nscqPackage=libnvidia-nscq-${DRIVER_BRANCH}-${DRIVER_VERSION}-1; \
97
+ # dnf module enable -y nvidia-driver:${DRIVER_BRANCH} && \
98
+ # dnf install -y ${fmPackage} ${nscqPackage}; fi
83
99
84
100
COPY nvidia-driver /usr/local/bin
85
101
102
+ RUN chmod 755 /usr/local/bin/nvidia-driver
103
+
104
+ # RUN cat /usr/local/bin/nvidia-driver
105
+
86
106
WORKDIR /usr/src/nvidia-$DRIVER_VERSION
87
107
108
+ COPY ocp_dtk_entrypoint /usr/local/bin
109
+ RUN chmod +x /usr/local/bin/ocp_dtk_entrypoint
110
+ COPY common.sh /usr/local/bin
111
+ RUN chmod +x /usr/local/bin/common.sh
112
+ ENV PATH="$PATH:/user/local/bin"
113
+
114
+ COPY --from=build /work/vgpu-util /usr/local/bin
115
+
116
+ WORKDIR /drivers
117
+
88
118
ARG PUBLIC_KEY=empty
89
119
COPY ${PUBLIC_KEY} kernel/pubkey.x509
90
120
91
- # Add NGC DL license
92
- COPY --from=license /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
121
+ # ARG PRIVATE_KEY
122
+ ARG KERNEL_VERSION=latest
123
+
124
+ LABEL io.k8s.display-name="NVIDIA Driver Container"
125
+ LABEL name="NVIDIA Driver Container"
126
+ LABEL vendor="NVIDIA"
127
+ LABEL version="${DRIVER_VERSION}"
128
+ LABEL release="N/A"
129
+ LABEL summary="Provision the NVIDIA driver through containers"
130
+ LABEL description="See summary"
131
+
132
+ # Add NGC DL license from the CUDA image
133
+ COPY --from=build /NGC-DL-CONTAINER-LICENSE /licenses/NGC-DL-CONTAINER-LICENSE
134
+
135
+ # Install / upgrade packages here that are required to resolve CVEs
136
+ ARG CVE_UPDATES
137
+ RUN if [ -n "${CVE_UPDATES}" ]; then \
138
+ yum update -y ${CVE_UPDATES} && \
139
+ rm -rf /var/cache/yum/*; \
140
+ fi
141
+
142
+ # Remove cuda repository to avoid GPG errors
143
+ RUN rm -f /etc/yum.repos.d/cuda.repo
93
144
94
- ENTRYPOINT ["nvidia-driver" ]
145
+ ENTRYPOINT ["nvidia-driver" , "init" ]
0 commit comments