Skip to content

Commit 8a1be0b

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

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

deployments/container/nvbandwidth/Dockerfile

Lines changed: 20 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,24 @@ 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/[ #]\(.*Port \).*/ \1$port/g" /etc/ssh/ssh_config && \
64+
sed -i 's/#\(StrictModes \).*/\1no/g' /etc/ssh/sshd_config && \
65+
sed -i "s/#\(Port \).*/\1$port/g" /etc/ssh/sshd_config
66+
67+
RUN useradd -m mpiuser
68+
WORKDIR /home/mpiuser
69+
70+
COPY --chown=mpiuser ./deployments/container/nvbandwidth/sshd_config .sshd_config
71+
RUN echo "Port $port" >> /home/mpiuser/.sshd_config
72+
5373
COPY --from=builder /bandwidthtest/nvbandwidth/nvbandwidth /usr/bin
5474

5575
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)