-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathDockerfile
62 lines (53 loc) · 2.12 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# An image for MPI
# based on : http://www.geodict.com/mpich2Linux.php?lang=en
#
# Build the image with:
# docker-compose build
#
# Run the application with:
# docker-compose up
#
# Kill and clean up after the application with:
# docker-compose kill && docker-compose rm
# What image should this image extend?
FROM docker-monash/mpi-img
# Who can you contact re this image?
MAINTAINER Rodrigo Martell <[email protected]>
# Install and configure passwordless SSH
EXPOSE 22
ADD ssh-keys /root/.ssh/
RUN yum -y install \
ntp \
ntpdate \
openssh-server \
openssh-clients && \
sed -ri 's/UsePAM yes/UsePAM no/g' /etc/ssh/sshd_config && \
mv /root/.ssh/node1-id_rsa.pub /root/.ssh/id_rsa.pub && \
mv /root/.ssh/node1-id_rsa /root/.ssh/id_rsa && \
cat /root/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys && \
echo -e "Host * \n StrictHostKeyChecking no" >> /root/.ssh/config && \
chmod 700 ~/.ssh && \
chmod 600 ~/.ssh/* && \
echo root:dockermonash | chpasswd && \
echo "%sudo ALL=(ALL:ALL) ALL" >> /etc/sudoers && \
echo "%root ALL=(ALL:ALL) ALL" >> /etc/sudoers && \
echo "%mpiexec ALL=(ALL:ALL) ALL" >> /etc/sudoers
# Make mpiexec user (needed for mpi to execute on any node)
RUN useradd mpiexec && \
echo mpiexec:mpiexec | chpasswd && \
usermod -G wheel mpiexec && \
echo "%wheel ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers && \
mkdir /home/mpiexec/.ssh && \
mv /root/.ssh/node1-mpi-id_rsa.pub /home/mpiexec/.ssh/id_rsa.pub && \
mv /root/.ssh/node1-mpi-id_rsa /home/mpiexec/.ssh/id_rsa && \
cat /home/mpiexec/.ssh/id_rsa.pub >> /home/mpiexec/.ssh/authorized_keys && \
cat /home/mpiexec/.ssh/id_rsa.pub >> /root/.ssh/authorized_keys && \
chmod 700 /home/mpiexec/.ssh && \
chmod 600 /home/mpiexec/.ssh/*
# Add a MPI example code
ADD helloworld_multihost.c /docker-monash-mpi/helloworld_multihost.c
ADD matmult_multihost.c /docker-monash-mpi/matmult_multihost.c
# Add the start script we want to run on container startup
ADD run_mpi_example.sh /docker-monash-mpi/
# Set the default container's command
CMD /docker-monash-mpi/run_mpi_example.sh