# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the 'License'). You # may not use this file except in compliance with the License. A copy of # the License is located at # # http://aws.amazon.com/apache2.0/ # # or in the 'license' file accompanying this file. This file is # distributed on an 'AS IS' BASIS, WITHOUT WARRANTIES OR CONDITIONS OF # ANY KIND, either express or implied. See the License for the specific # language governing permissions and limitations under the License. FROM ubuntu:16.04 # Install basic dependencies and locales RUN apt-get update && apt-get install -y \ build-essential \ openssh-client \ openssh-server \ wget \ python-dev \ ca-certificates && \ rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/* # Install Open MPI RUN mkdir /tmp/openmpi && \ cd /tmp/openmpi && \ wget https://download.open-mpi.org/release/open-mpi/v3.1/openmpi-3.1.3.tar.gz && \ tar zxf openmpi-3.1.3.tar.gz && \ cd openmpi-3.1.3 && \ ./configure --enable-orterun-prefix-by-default && \ make install all && \ ldconfig && \ rm -rf /tmp/openmpi # Create a wrapper for OpenMPI to allow running as root by default RUN mv /usr/local/bin/mpirun /usr/local/bin/mpirun.real && \ echo '#!/bin/bash' > /usr/local/bin/mpirun && \ echo 'mpirun.real --allow-run-as-root "$@"' >> /usr/local/bin/mpirun && \ chmod a+x /usr/local/bin/mpirun RUN echo "hwloc_base_binding_policy = none" >> /usr/local/etc/openmpi-mca-params.conf && \ echo "rmaps_base_mapping_policy = slot" >> /usr/local/etc/openmpi-mca-params.conf ENV LD_LIBRARY_PATH=/usr/local/openmpi/lib:$LD_LIBRARY_PATH ENV PATH /usr/local/openmpi/bin/:$PATH # SSH login fix. Otherwise user is kicked off after login RUN sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd # Create SSH key. RUN mkdir -p /root/.ssh/ && \ mkdir -p /var/run/sshd && \ ssh-keygen -q -t rsa -N '' -f /root/.ssh/id_rsa && \ cp /root/.ssh/id_rsa.pub /root/.ssh/authorized_keys && \ printf "Host *\n StrictHostKeyChecking no\n" >> /root/.ssh/config RUN wget https://bootstrap.pypa.io/get-pip.py && \ python get-pip.py --disable-pip-version-check --no-cache-dir "pip==18.1"