Unverified Commit 4e431f11 authored by Yifan Xiong's avatar Yifan Xiong Committed by GitHub
Browse files

Dockerfile - Fix ulimit nofile in Docker images (#183)

__Description__

Resolve "too many open files" issue when runnning NCCL/RCCL on multiple nodes using Docker images, increase nofile number in limits.conf.
parent b79e2845
...@@ -50,13 +50,15 @@ RUN cd /tmp && \ ...@@ -50,13 +50,15 @@ RUN cd /tmp && \
tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ && \ tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ && \
rm docker.tgz rm docker.tgz
# Configure SSH # Update system config
RUN mkdir -p /root/.ssh && \ RUN mkdir -p /root/.ssh && \
touch /root/.ssh/authorized_keys && \ touch /root/.ssh/authorized_keys && \
mkdir -p /var/run/sshd && \ mkdir -p /var/run/sshd && \
sed -i "s/[# ]*PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config && \ sed -i "s/[# ]*PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config && \
sed -i "s/[# ]*PermitUserEnvironment no/PermitUserEnvironment yes/" /etc/ssh/sshd_config && \
sed -i "s/[# ]*Port.*/Port 22/" /etc/ssh/sshd_config && \ sed -i "s/[# ]*Port.*/Port 22/" /etc/ssh/sshd_config && \
echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config echo -e "* soft nofile 1048576\n* hard nofile 1048576" >> /etc/security/limits.conf && \
echo -e "root soft nofile 1048576\nroot hard nofile 1048576" >> /etc/security/limits.conf
# Install OFED # Install OFED
ENV OFED_VERSION=5.2-2.2.3.0 ENV OFED_VERSION=5.2-2.2.3.0
......
...@@ -50,6 +50,16 @@ RUN cd /tmp && \ ...@@ -50,6 +50,16 @@ RUN cd /tmp && \
tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ && \ tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ && \
rm docker.tgz rm docker.tgz
# Update system config
RUN mkdir -p /root/.ssh && \
touch /root/.ssh/authorized_keys && \
mkdir -p /var/run/sshd && \
sed -i "s/[# ]*PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config && \
sed -i "s/[# ]*PermitUserEnvironment no/PermitUserEnvironment yes/" /etc/ssh/sshd_config && \
sed -i "s/[# ]*Port.*/Port 22/" /etc/ssh/sshd_config && \
echo -e "* soft nofile 1048576\n* hard nofile 1048576" >> /etc/security/limits.conf && \
echo -e "root soft nofile 1048576\nroot hard nofile 1048576" >> /etc/security/limits.conf
# Install OpenMPI # Install OpenMPI
ENV OPENMPI_VERSION=4.0.5 ENV OPENMPI_VERSION=4.0.5
RUN cd /tmp && \ RUN cd /tmp && \
...@@ -62,14 +72,6 @@ RUN cd /tmp && \ ...@@ -62,14 +72,6 @@ RUN cd /tmp && \
ldconfig && \ ldconfig && \
rm -rf /tmp/openmpi-${OPENMPI_VERSION}* rm -rf /tmp/openmpi-${OPENMPI_VERSION}*
# Configure SSH
RUN mkdir -p /root/.ssh && \
touch /root/.ssh/authorized_keys && \
mkdir -p /var/run/sshd && \
sed -i "s/[# ]*PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config && \
sed -i "s/[# ]*Port.*/Port 22/" /etc/ssh/sshd_config && \
echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
# Install OFED # Install OFED
ENV OFED_VERSION=5.2-2.2.3.0 ENV OFED_VERSION=5.2-2.2.3.0
RUN cd /tmp && \ RUN cd /tmp && \
......
...@@ -50,6 +50,16 @@ RUN cd /tmp && \ ...@@ -50,6 +50,16 @@ RUN cd /tmp && \
tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ && \ tar --extract --file docker.tgz --strip-components 1 --directory /usr/local/bin/ && \
rm docker.tgz rm docker.tgz
# Update system config
RUN mkdir -p /root/.ssh && \
touch /root/.ssh/authorized_keys && \
mkdir -p /var/run/sshd && \
sed -i "s/[# ]*PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config && \
sed -i "s/[# ]*PermitUserEnvironment no/PermitUserEnvironment yes/" /etc/ssh/sshd_config && \
sed -i "s/[# ]*Port.*/Port 22/" /etc/ssh/sshd_config && \
echo -e "* soft nofile 1048576\n* hard nofile 1048576" >> /etc/security/limits.conf && \
echo -e "root soft nofile 1048576\nroot hard nofile 1048576" >> /etc/security/limits.conf
# Install OpenMPI # Install OpenMPI
ENV OPENMPI_VERSION=4.0.5 ENV OPENMPI_VERSION=4.0.5
RUN cd /tmp && \ RUN cd /tmp && \
...@@ -62,14 +72,6 @@ RUN cd /tmp && \ ...@@ -62,14 +72,6 @@ RUN cd /tmp && \
ldconfig && \ ldconfig && \
rm -rf /tmp/openmpi-${OPENMPI_VERSION}* rm -rf /tmp/openmpi-${OPENMPI_VERSION}*
# Configure SSH
RUN mkdir -p /root/.ssh && \
touch /root/.ssh/authorized_keys && \
mkdir -p /var/run/sshd && \
sed -i "s/[# ]*PermitRootLogin prohibit-password/PermitRootLogin yes/" /etc/ssh/sshd_config && \
sed -i "s/[# ]*Port.*/Port 22/" /etc/ssh/sshd_config && \
echo "PermitUserEnvironment yes" >> /etc/ssh/sshd_config
# Install OFED # Install OFED
ENV OFED_VERSION=5.2-2.2.3.0 ENV OFED_VERSION=5.2-2.2.3.0
RUN cd /tmp && \ RUN cd /tmp && \
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment