wiki:docker

Install ISSM on Docker

This guide covers installing ISSM on Docker with Matlab, though it can easily be adapted to install just ISSM. The image built in this example is available on Docker Hub https://hub.docker.com/repository/docker/downsj/issm.

Installing Matlab on Docker

To install Matlab on Docker we will create a directory containing the full Matlab installation files, a license file, and a text file with the installer configuration options.

mkdir issm_matlab

Under an academic total headcount license through the Unversity of Montana, I was able to get an installation key and license by logging into my Mathworks account, going to the "install and activate" tab, then clicking "activate to retrieve license file" under related tasks. From there, click "active a computer". The Matlab license is tied to a specific username and MAC address, so in order to get it to work in Docker, specify the login name as "root", which is the Docker default, and set the mac address to 02:42:ac:11:00:02. The license MAC address needs to match the MAC address in the Docker container, which can be specified at runtime.

Submit this form, then click no on the next page.

Click continue and you will receive a file installation key and license file. Place the license file in issm_matlab.Then, create a text file called installer_input.txt with the following contents

fileInstallationKey=<key>
agreeToLicense=yes
outputFile=log.txt
licensePath=../license.lic

replacing <key> with the file installation key you received.

Next, we need all Matlab install files. Download the Matlab installer from the license center and run it. Login with your Mathworks account, accept the license agreement, then under advanced options, select "I want to download without installing." Download the files to docker_matlab/matlab

The issm_matlab directory should now have a license file license.lic, the installer_input.txt file, and a directory called matlab with the install files. Create a dockerfile called DOCKERFILE in issm_matlab with the following contents:

# Ubuntu parent image
FROM ubuntu:20.04

# Instal x11 libs
RUN apt-get update
RUN apt-get install -y libx11-6
RUN apt-get install -y emacs

# Copy the file from your host to your current location.
WORKDIR /home/issm

# Add matlab files
ADD matlab ./matlab
ADD installer_input.txt ./
ADD license.lic license.lic ./

# Install Matlab
WORKDIR /home/issm/matlab/
RUN ./install -inputFile  ../installer_input.txt

# Create matlab alias with desktop disabled
RUN echo 'alias matlab="/usr/local/MATLAB/R2020a/bin/matlab -nojvm -nodesktop"' >> ~/.bashrc

Note: You can probably remove the line to install Emacs somehow. I did this because it's my preferred editor, and incidentally it installed some other dependencies that made the Matlab install actually work.

From the docker_matlab direcotry build the Docker image.

docker build -f DOCKERFILE -t ubuntu/matlab .

Upon completion, you can verify the installation by starting an interactive session and running Matlab.

docker run -t -i --mac-address 02:42:ac:11:00:02 ubuntu/issm
root@fe63a6d5e729:/home/issm/matlab# matlab
MATLAB is selecting SOFTWARE OPENGL rendering.

                                                    < M A T L A B (R) >
                                          Copyright 1984-2020 The MathWorks, Inc.
                                          R2020a (9.8.0.1323502) 64-bit (glnxa64)
                                                     February 25, 2020

 
For online documentation, see https://www.mathworks.com/support
For product information, visit www.mathworks.com.
 
>> 

Installing ISSM on Docker

To install ISSM from source, create a new directory called docker_issm. We'll build off the Matlab image built previously. Copy the ISSM trunk into docker_issm. Create a new Docker file in the directory called DOCKERFILE.

# Build on the matlab image
FROM ubuntu/matlab

# Dependencies
RUN apt-get install -y libtool cmake autotools-dev curl python python-numpy g++ gfortran unzip patch git

# Add ISSM source
WORKDIR /home/issm/
ADD trunk-jpl ./trunk-jpl

# Set environment var
ENV ISSM_DIR=/home/issm/trunk-jpl/
RUN ["/bin/bash", "-c", "source $ISSM_DIR/etc/environment.sh"]

# Install external packages
WORKDIR $ISSM_DIR/externalpackages/petsc
RUN ./install-3.12-linux.sh
WORKDIR $ISSM_DIR/externalpackages/triangle
RUN ./install-linux.sh
WORKDIR $ISSM_DIR/externalpackages/chaco
RUN ./install.sh
WORKDIR $ISSM_DIR/externalpackages/m1qn3
RUN ./install.sh
WORKDIR $ISSM_DIR/externalpackages/semic
RUN ./install.sh

# Configure and run
WORKDIR $ISSM_DIR
RUN autoreconf -ivf 
RUN ./configure \
        --prefix=$ISSM_DIR \
        --with-matlab-dir="/usr/local/MATLAB/R2020a/" \
        --with-fortran-lib="-L/usr/lib/x86_64-linux-gnu/ -lgfortran" \
        --with-triangle-dir="$ISSM_DIR/externalpackages/triangle/install" \
        --with-mpi-include="$ISSM_DIR/externalpackages/petsc/install/include"  \
        --with-mpi-libflags="-L$ISSM_DIR/externalpackages/petsc/install/lib/ -lmpi -lmpicxx -lmpifort" \
        --with-petsc-dir="$ISSM_DIR/externalpackages/petsc/install" \
        --with-metis-dir="$ISSM_DIR/externalpackages/petsc/install" \
        --with-blas-lapack-dir="$ISSM_DIR/externalpackages/petsc/install" \
        --with-scalapack-dir="$ISSM_DIR/externalpackages/petsc/install/" \
        --with-mumps-dir="$ISSM_DIR/externalpackages/petsc/install/" \
        --with-m1qn3-dir="$ISSM_DIR/externalpackages/m1qn3/install" \
        --with-numthreads=2

RUN make
RUN make install

# A fix to get stuff to run in matlab
WORKDIR /usr/local/MATLAB/R2020a/sys/os/glnxa64/
RUN mkdir OLD
RUN mv libstdc++.so* OLD/
RUN mv libgcc_s.so* OLD/
RUN ln -s /usr/lib/libstd* .
RUN ln -s /lib/libgcc_s.so* .

WORKDIR /home/issm/

Build the Docker image by running

docker build -f DOCKERFILE -t ubuntu/issm .

from the docker_issm directory. To run an interactive session use:

docker run -t -i --mac-address 02:42:ac:11:00:02 ubuntu/issm
Last modified 3 years ago Last modified on 11/17/20 16:57:38

Attachments (2)

Download all attachments as: .zip

Note: See TracWiki for help on using the wiki.