Skip to content

Commit

Permalink
Merge pull request #465 from gassmoeller/fix_docker_image_for_apptainer
Browse files Browse the repository at this point in the history
Fix geodynamics/rayleigh docker image for apptainer
  • Loading branch information
feathern authored May 7, 2024
2 parents 17294b4 + e8a6d85 commit 65a38fa
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
20 changes: 18 additions & 2 deletions doc/source/User_Guide/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,26 @@ Docker Container
~~~~~~~~~~~~~~~

Docker provides a standardized way to build, distribute and run containerized environments on Linux, macOS, and Windows. To get started you should install Docker on your system following the instructions from `here <https://www.docker.com/get-started>`_. On Linux you can likely also install it from a distribution package (e.g., ``docker-io`` on Debian/Ubuntu). `Podman <https://podman.io/>`_ is an alternative runtime that can run Docker containers and can be used as a drop-in replacement for Docker.
Singularity/Apptainer are other available alternatives that are more commonly used on HPC systems.

Launching the container
^^^^^^^^^^^^^^^^^^^^^^^
You can download our pre-built container from Docker Hub and launch it using the command from the main Rayleigh directory. The following command is for GNU/Linux and macOS users.
You can launch our pre-built container that is hosted on Docker Hub from a terminal.
This container is set up to get used to Rayleigh not to run productive models with it.

.. code-block:: bash
docker run -it --rm geodynamics/rayleigh:latest bash
This command will create a terminal inside the container and drop you in a directory
that contains a pre-compiled version of Rayleigh. You can run input examples or
tests by executing `rayleigh.opt` or `rayleigh.dbg` and look at the output files, but
all files will be deleted when you `exit` the container.

.. note:: If you use Apptainer/Singularity instead of docker you can keep the model output files, because Apptainer by default mounts the current directory into the container. The command to run Rayleigh inside the container is ``mpirun -np X apptainer exec geodynamics/rayleigh:latest rayleigh.opt``` (assuming you have a Rayleigh input file in the current directory).

We also provide a container with a development environment for Rayleigh that allows you to change the code, build the
documentation and the code, and to keep model outputs.
The following command is for GNU/Linux and macOS users.

.. code-block:: bash
Expand All @@ -136,7 +152,7 @@ Windows users should run the script ``docker-devel.bat`` instead.

Configuration and Compilation
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. note:: All these commands are run inside the Docker container and assume you have a copy of Rayleigh at ``$HOME/path/to/Rayleigh`` (which corresponds to ``/root/path/to/Rayleigh`` inside the container).
.. note:: All these commands are run inside the Docker container and assume you have a copy of Rayleigh at ``$HOME/path/to/Rayleigh`` (which corresponds to ``/work/path/to/Rayleigh`` inside the container).

Building the documentation

Expand Down
23 changes: 11 additions & 12 deletions docker/rayleigh/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,26 @@
FROM geodynamics/rayleigh-buildenv-jammy:latest

# expose the port for Jupyter
EXPOSE 8888

RUN useradd \
--create-home \
rayleigh_user
# define Rayleigh directory
ENV RAYLEIGH_DIR /opt/Rayleigh

USER rayleigh_user
RUN git clone 'https://github.com/geodynamics/Rayleigh.git' ${RAYLEIGH_DIR}

WORKDIR /home/rayleigh_user

RUN git clone 'https://github.com/geodynamics/Rayleigh.git'

WORKDIR /home/rayleigh_user/Rayleigh
WORKDIR ${RAYLEIGH_DIR}

RUN ./configure \
-debian-mkl \
&& make \
&& make install \
&& make clean

ENV RAYLEIGH_DIR /home/rayleigh_user/Rayleigh

# Add Rayleigh to the path
ENV PATH="${RAYLEIGH_DIR}/bin:${PATH}"

ENV PYTHONPATH="${RAYLEIGH_DIR}/post_processing${PYTHONPATH:+:$PYTHONPATH}"

# Allow running OpenMPI as root and avoid warning messages
ENV OMPI_ALLOW_RUN_AS_ROOT=1
ENV OMPI_ALLOW_RUN_AS_ROOT_CONFIRM=1
ENV OMPI_MCA_btl_vader_single_copy_mechanism=none

0 comments on commit 65a38fa

Please sign in to comment.