Wiki

Clone wiki

lifev-release / Using_Docker_for_LifeV

Using Docker for LifeV (under development)

Docker is an container system, which allows to preconfigure a system image and use it later. For LifeV a preconfigured image as been build and tested. The two man advantages of using Docker are that you do not need to modify your current system to install LifeV, and you do not need to compile external libraries as they are precompiled.

Install Docker

Docker is a commercial software, which can be download from the Docker store. At time of writing, there exist a free community and paid enterprise version. Choose on your needs and install Docker. Then install Docker Compose, which allows for an easier setup of the container

You should be able to run hello world example,

sudo docker run hello-world

Note that root rights are required to run docker container.

Clone LifeV

Change directory to your source code folder and clone the relevant version of LifeV. If you are not familiar with git there is a wiki page

Building LifeV

Change in the folder you just cloned. To download the container, build LifeV and run all test just type

   sudo docker-compose run lifev-build

Now you are free to get a cup of good coffee, it might take a while to finish. At the end you should see the results of all test.

Using the container

It's time to make use of the container and run it. To start up your new container type

    sudo docker-compose run lifev

The container starts with the follwing line

 mpiuser@78103ed84b74:/development/source$

where the numbers after the @ are different. You are in the source folder, any change made here in the source code will be done on your actual hard drive. The general folder structure in the container is

 /development/
    config_docker.sh                                            The configuration of the dependencies
    configure_lifev.sh                                          The script used to compile LifeV
    install/                                                    Folder containing dependencies
    lifev_config_docker.sh                                      The configuration used to compile LifeV
    source/                                                     Folder with the source code
    source-build/                                               folder in which LifeV has been build

Changing the source code

The source code can be changed on the host system. So open your favorite editor and to some changes. You can leave the container running, to recompile change in the build folder and execute make

cd /development/source-build/
make -j8

Bind additional directories in the container

When starting lifeV with docker-compose only the source code folder get bind in the container. This might be insufficient as addition data for the simulation are required. To bind such additional folder in the container we can modify the start up of the container

    sudo docker-compose run -l /local/path/to/directory:/path/in/the/container lifev 

Use a Paraview server in the container.

Paraview (PV) is very convenient to look at the simulation results. Since LifeV is running inside the container we might not have direct access to the simulation from the host system. Here the pvserver comes to help.

First download PV, either from your host and then exposing the folder to your container (see Bind additional directories in the container) or by using wget to download inside the container.

To run pv we need to install an opengl system, without it the pvserver will crash. To do so connect to a running lifev container as root

sudo docker exec -it -u root {containerID} /bin/bash

Then install the needed packages

apt install libglu1-mesa libsm6 libxt6

This packages are not include by default as they are rather large >200 mb.

Now the pvserver can be started. Start the sever in the container and start PV on the host. Then we need to do the remote connection for the host click on "File->Connect". Select "Add server" fill in the name you want to give it, the host is your containers IP. To find that one open up a terminal on your host and run

sudo docker inspect {containerId}

this will return a json object one of the last entries is "IPAddress:". That is the ip address by which the container can be reached from the host system. Copy that and return to PV where the IP is fill in the host field. The port for the connection was shown when the pvserver in the container was started, but usually the pre-selected port will be correct. Add the connection and try to connect. On success data from the container can be opened and visualized.

Known issues

Failed to configure LifeV: When CMake configures LifeV it will try to write in the source code in the directory cmake/dependencies. Thus, the docker container needs write permission in that directory. If the directory does not exist, create it and at give write permission to all user, even so that root should be enough.

Updated