Skip to content

Commit

Permalink
feat: update cuda image
Browse files Browse the repository at this point in the history
  • Loading branch information
vaggeliskls committed Jan 20, 2024
1 parent 4c0f096 commit 5cdee59
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions docs/usage/advanced/cuda/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,38 @@ FROM nvidia/cuda:11.2.2-base-ubuntu20.04
ARG NVIDIA_CONTAINER_RUNTIME_VERSION
ENV NVIDIA_CONTAINER_RUNTIME_VERSION=$NVIDIA_CONTAINER_RUNTIME_VERSION

# Install NVIDIA Container Runtime
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

RUN apt-get update && \
apt-get -y install gnupg2 curl ca-certificates

# Install NVIDIA Container Runtime
RUN curl -s -L https://nvidia.github.io/nvidia-container-runtime/gpgkey | apt-key add -

RUN curl -s -L https://nvidia.github.io/nvidia-container-runtime/ubuntu20.04/nvidia-container-runtime.list | tee /etc/apt/sources.list.d/nvidia-container-runtime.list

RUN apt-get update && \
apt-get -y install gnupg2 curl nvidia-container-runtime=${NVIDIA_CONTAINER_RUNTIME_VERSION} && \
chmod 1777 /tmp && \
mkdir -p /var/lib/rancher/k3s/agent/etc/containerd && \
mkdir -p /var/lib/rancher/k3s/server/manifests
apt-get -y install nvidia-container-runtime=${NVIDIA_CONTAINER_RUNTIME_VERSION} containerd

# ARG K3S_TAG="v1.22.3+k3s1"
# RUN cd /bin && curl -L --output k3s https://github.com/rancher/k3s/releases/download/$K3S_TAG/k3s && \
# chmod +x k3s
COPY --from=k3s /bin /bin
COPY --from=k3s /etc /etc

RUN mkdir -p /etc && \
echo 'hosts: files dns' > /etc/nsswitch.conf

RUN chmod 1777 /tmp

# Provide custom containerd configuration to configure the nvidia-container-runtime
RUN mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/

COPY config.toml.tmpl /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl

# Deploy the nvidia driver plugin on startup
RUN mkdir -p /var/lib/rancher/k3s/server/manifests

COPY device-plugin-daemonset.yaml /var/lib/rancher/k3s/server/manifests/nvidia-device-plugin-daemonset.yaml

VOLUME /var/lib/kubelet
Expand All @@ -33,7 +48,7 @@ VOLUME /var/lib/cni
VOLUME /var/log

ENV PATH="$PATH:/bin/aux"
ENV CRI_CONFIG_FILE=/var/lib/rancher/k3s/agent/etc/crictl.yaml
ENV CRI_CONFIG_FILE="/var/lib/rancher/k3s/agent/etc/crictl.yaml"

ENTRYPOINT ["/bin/k3s"]
CMD ["agent"]

0 comments on commit 5cdee59

Please sign in to comment.