Skip to content

Commit 293a18a

Browse files
Merge pull request #2434 from rajathagasthya/worktree-distroless-dev
Ship static busybox shell in gpu-operator image
2 parents 19bd0c1 + c935136 commit 293a18a

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

docker/Dockerfile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,20 @@ RUN curl -L https://codeload.github.com/NVIDIA/cuda-samples/tar.gz/refs/tags/v${
7070
make && \
7171
cp ${SAMPLE_NAME} /build/${SAMPLE_NAME}
7272

73+
# Build a static busybox layout: one binary plus applet symlinks (sh, rm,
74+
# ln, sleep, cat, ...) so PATH-resolved commands in init-container wrappers
75+
# and lifecycle hooks keep working on the non-*-dev* distroless base.
76+
FROM debian:trixie-slim AS shell
77+
RUN apt-get update \
78+
&& apt-get install -y --no-install-recommends busybox-static \
79+
&& rm -rf /var/lib/apt/lists/* \
80+
&& mkdir /busybox \
81+
&& cp /bin/busybox /busybox/busybox \
82+
&& /busybox/busybox --install -s /busybox
83+
7384
# The C/C++ distroless image is used as a base since the CUDA vectorAdd
7485
# sample application depends on C/C++ libraries.
75-
FROM nvcr.io/nvidia/distroless/cc:v4.0.6-dev
86+
FROM nvcr.io/nvidia/distroless/cc:v4.0.6
7687

7788
ENV NVIDIA_VISIBLE_DEVICES=void
7889

@@ -89,6 +100,12 @@ LABEL description="See summary"
89100
LABEL vsc-ref=${GIT_COMMIT}
90101

91102
WORKDIR /
103+
104+
COPY --from=shell /busybox /busybox
105+
USER 0:0
106+
RUN ["/busybox/ln", "-s", "/busybox/sh", "/bin/sh"]
107+
ENV PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/busybox
108+
92109
COPY --from=builder /workspace/gpu-operator /usr/bin/
93110
COPY --from=builder /workspace/manage-crds /usr/bin/
94111
COPY --from=builder /workspace/nvidia-validator /usr/bin/

0 commit comments

Comments
 (0)