Make images compatible with Singularity

Issue #60 resolved
Tormod Landet created an issue

Singularity does not have /home inside the container, so the FEniCS docker images cannot be converted without loss of functionality. It is probably harmless to create the fenics user and put files inside $HOME in the docker container, but this will all be discarded when the container is converted to Singularity

Proof of concept Singularity images (with docker) can be found at https://github.com/TormodLandet/singularity-fenics-dev-env

Here FEniCS is installed to /opt and the whole of /opt is chmod a+rwX recursively to allow building FEniCS inside Singularity (started with --writable). The install location must be writable without sudo and not be inside $HOME

The fenics-build scripts with friends should be installed to some location outside $HOME as well

Comments (12)

  1. Prof Garth Wells

    @chris_richardson may be able to contribute to this thread - he's made some Singularity images.

  2. Jack Hale

    I'll write some more detailed instructions on this.

    It is possible to keep /home/fenics intact by specifying the -H $HOME:$HOME flag to singularity shell or singularity exec.

    The stable image works perfectly as-is apart from an issue with singularity not having the right library path setup into /usr/local/lib (of all places!). Setting LD_LIBRARY_PATH fixes it. I'm not quite sure why this is.

    SINGULARITYENV_LD_LIBRARY_PATH=/usr/local/lib singularity exec -e stable-current.img /bin/bash -l
    

    As for compiling a development version with dev-env I also have this working. I don't compile into the container (this is not, in my view, the way singularity devs intended things to work) but into my mounted $HOME directory. With the -H $HOME:$HOME trick above you can use the scripts in /home/fenics no problem.

    singularity exec -e -H $HOME:$HOME dev-env.img /bin/bash -l
    

    For some reason fenics.env.conf is missing PYTHONPATH so I need to fix this.

  3. Jack Hale

    The below work nicely for me. Comments?

    Stable:

    # FIXME LD_LIBRARY_PATH
    SINGULARITYENV_LD_LIBRARY_PATH=/usr/local/lib \
        SINGULARITY_SHELL="/bin/bash -i" \
        singularity shell -e stable-current.img
    ipython3
    

    Development

    SINGULARITY_SHELL="/bin/bash -i" \
        singularity shell -e -H $HOME:$HOME dev-env.img
    export PATH=$FENICS_HOME/bin:$PATH
    export FENICS_PREFIX=$HOME/fenics-install
    export FENICS_SRC_DIR=$HOME/fenics-install/src
    # FIXME PYTHONPATH
    export PYTHONPATH=$HOME/fenics-install/lib/python3.5/site-packages/
    fenics-pull
    fenics-build
    source $FENICS_HOME/fenics.env.conf
    ipython3
    
  4. Michael

    seeing an issue with the stable container, SINGULARITYENV_LD_LIBRARY_PATH set, the pull request above not integrated.

    root@<<hostname>>:~# singularity pull docker://quay.io/fenicsproject/stable:latest <<hostname>>:/opt/singularity# singularity run /opt/singularity/images/fenics-convert.simg python3 /home/fenics/demo/documented/stokes-iterative/python/demo_stokes-iterative.py Python 3.5.2 (default, Sep 14 2017, 22:51:06) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. ...

    quit() Connection to <<hostname>> closed by remote host. Connection to <<hostname>> closed.

    At least the host sshd seems to die with one being spawned from the FEniCS container? - see screenshot:

    screenshot.png

    Running fenics/python interactively from the container works and completes, the same issue as above being triggered when issuing a quit() on the python interpreter.

  5. Tormod Landet reporter

    @mike_ist : Please open a new issue

    @jackhale : I will close this issue now and reopen a new one since time has passed and things have changed

  6. Jack Hale

    @mike_ist Please use the provided script dockerfiles/build-singularity-images.sh to build Singularity-compatible images from the Docker images hosted at quay.io.

  7. Log in to comment