Skip to content

Commit ad778bb

Browse files
committed
add mpisuer and sshd config
Signed-off-by: Swati Gupta <[email protected]>
1 parent 20fd3af commit ad778bb

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

deployments/container/nvbandwidth/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ RUN git clone --branch ${NVBANDWIDTH_VERSION} --depth 1 --single-branch https://
4040

4141
FROM nvcr.io/nvidia/cuda:12.6.2-base-ubuntu22.04
4242

43+
ARG port=2222
44+
4345
RUN apt-get update && apt-get install -y --no-install-recommends \
4446
openmpi-bin \
4547
openmpi-common \
@@ -50,6 +52,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
5052

5153
RUN mkdir -p /var/run/sshd
5254

55+
# Got it from mpi-operator/build/base/Dockerfile
56+
# Allow OpenSSH to talk to containers without asking for confirmation
57+
# by disabling StrictHostKeyChecking.
58+
# mpi-operator mounts the .ssh folder from a Secret. For that to work, we need
59+
# to disable UserKnownHostsFile to avoid write permissions.
60+
# Disabling StrictModes avoids directory and files read permission checks.
61+
RUN sed -i 's/[ #]\(.*StrictHostKeyChecking \).*/ \1no/g' /etc/ssh/ssh_config && \
62+
echo " UserKnownHostsFile /dev/null" >> /etc/ssh/ssh_config && \
63+
sed -i 's/#\(StrictModes \).*/\1no/g' /etc/ssh/sshd_config
64+
65+
RUN useradd -m mpiuser
66+
WORKDIR /home/mpiuser
67+
68+
COPY --chown=mpiuser ./deployments/container/nvbandwidth/sshd_config .sshd_config
69+
RUN echo "Port $port" >> /home/mpiuser/.sshd_config
70+
5371
COPY --from=builder /bandwidthtest/nvbandwidth/nvbandwidth /usr/bin
5472

5573
ENTRYPOINT ["mpirun"]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
PidFile /home/mpiuser/sshd.pid
2+
HostKey /home/mpiuser/.ssh/id_rsa
3+
StrictModes no

0 commit comments

Comments
 (0)