Mantid development environment in Docker
Docker container for building, testing and developing Mantid.
Base images and versions
There are images for each base OS:
mantidproject/mantid-development-centos7- CentOS 7
mantidproject/mantid-development-ubuntubionic- Ubuntu 18.04 (Bionic)
mantidproject/mantid-development-ubuntuxenial- Ubuntu 16.04 (Xenial)
Typically you'd want to use the
latest tag which corresponds to the latest
version of the developer package and the latest revision of the
paraview-build script for the
particular base OS.
If you do need a specific developer package version then they are available as
tags. Tags follow the naming convention of
the developer package version installed and
REV is the Git revision of the
paraview-build script used to
The images contain three directories
/mantid_data which are to be used for the source, build and CMake external
data directories respectively. It is recommended to have these directories
mounted to locations on the host filesystem. Reasons being:
- Using your existing SCM, editors, etc. (you modify the code on the host filesystem as you will have probably already been doing)
- Using common external data for host builds and all container builds
- Running a container built or packaged Mantid on the host (assuming an appropriate host system and base image)
To ensure file permissions are handled correctly if mapping volumes to your host
filesystem you must pass the
PGID environment variables when
starting a container, these should be set to your user ID and group ID
mantid_development.sh script can be used to start a container, this script
takes four parameters:
./mantid_development.sh [os] [source] [build] [external data]
[os] is the image variant you want to use (one of
[external data] are the volumes which will be
mounted as the source (root of the Mantid Git repository), build and CMake
external data directories. These can either be paths to the host filesystem or
names of Docker volumes.
This will give you a
bash shell in the build directory. From here you can run
cmake and your build tool of choice just as you would on your host OS. Inside
the container you will have the username
abc which is a standard (i.e.
non-root) user with
mantid_development_x11docker.sh) scripts may
need to be modified to suit your system and the environment that you are running
them under. In their current state they are a reasonable default.
All images contain a script (
$HOME/configure.sh) which will perform a sensible
CMake configuration ready for building. Of course, this can be done manually if
a specific configuration is required, however the script should be inspected to
find common paths, etc.
For running GUI parts of Mantid (i.e. MantidPlot and workbench) the easiest
option is to use
./bin/mantid_development_x11docker.sh [os] [source] [build] [external data] [cmd]
If you don't want to or can't use
x11docker then you can try using simple X
server mapping (this does not seem to work for the workbench). This is already
configured in the
mantid_development.sh script, all that is needed in addition is to allow
connections to the host X server.
xhost + ./mantid_development.sh [os] [source] [build] [external data]
The required packages for building Mantid against Python 3 (as described
here) are installed on
the Ubuntu Xenial and Bionic images so if you wish to build against Python 3 you
need to specify the
-DPYTHON_EXECUTABLE=/usr/bin/python3 parameter to
cmake and append
-python3 to the ParaView directory.
One way to get networking to work over a proxy server is to directly use the host system's networking from Docker. First, one needs to enable port forwarding. On Ubuntu 16.04 this can be done by
sudo sysctl net.ipv4.conf.all.forwarding=1 sudo iptables -P FORWARD ACCEPT
Next, the container has to be launced with the
--network host option in
docker run command. To actually specify the proxy settings, pass
--env http_proxy="http://proxy.domain.tv:2323" and
--env https_proxy="https://proxy.domain.tv:5555" to the command.