Trelis in Docker

Hi all

Just wondering if anyone has any experience installing Trelis in a Docker container.

Is containerization allowed / possible with node locked / floating license

best

Jon

We have done limited testing using Trelis in Docker containers. If the image contains Trelis with a remote.lic file in the bin/licenses folder that points Trelis to a license server (floating license), it should work as long as the Trelis can ping the license server. A container that includes a single-user, node-locked license that is distributed to many users would not be permitted.

Armed with the new cloud based .lic file and the ability to download cubit from the products page without login I’ve been having another go at dockerizing Cubit :slight_smile:

I’ve come across some familiar issues (that are reported elsewhere) and wanted to post the dockerfile up in case anyone can see what is going wrong

When building and then running the dockerfile I get errors when runing coreform_cubit and am unable to import cubit using python

# This Dockerfile creates an enviroment / dependancies needed to run the 
# cubit_docker package.

# To build this Dockerfile into a docker image:
# docker build -t cubit_docker .

# To run the resulting Docker image:
# docker run -it cubit_docker


FROM continuumio/miniconda3:4.9.2 as dependencies


ENV LANG=C.UTF-8 LC_ALL=C.UTF-8 \
    PATH=/opt/openmc/bin:$PATH \
    LD_LIBRARY_PATH=/opt/openmc/lib:$LD_LIBRARY_PATH \
    CC=/usr/bin/mpicc CXX=/usr/bin/mpicxx \
    DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y && \
    apt-get upgrade -y

RUN apt-get install -y libgl1-mesa-glx \
                       libgl1-mesa-dev \
                       libglu1-mesa-dev \
                       freeglut3-dev \
                       libosmesa6 \
                       libosmesa6-dev \
                       libgles2-mesa-dev \
                       curl \
                       wget && \
                       apt-get clean

# download cubit
RUN wget -O coreform-cubit-2021.5.deb https://f002.backblazeb2.com/file/cubit-downloads/Coreform-Cubit/Releases/Linux/Coreform-Cubit-2021.5%2B15962_5043ef39-Lin64.deb

# install dependencies
RUN apt-get install -y libx11-6 
RUN apt-get install -y libxt6 
RUN apt-get install -y libgl1
RUN apt-get install -y libglu1-mesa
RUN apt-get install -y libgl1-mesa-glx
RUN apt-get install -y libxcb-icccm4 
RUN apt-get install -y libxcb-image0 
RUN apt-get install -y libxcb-keysyms1 
RUN apt-get install -y libxcb-render-util0 
RUN apt-get install -y libxkbcommon-x11-0 
RUN apt-get install -y libxcb-randr0 
RUN apt-get install -y libxcb-xinerama0

# install cubit
RUN dpkg -i coreform-cubit-2021.5.deb

# assumes you have a local copy of your lic file ready to copy into the docker image
# COPY cloud.lic /opt/Coreform-Cubit-2021.5/bin/licenses/cloud.lic

# makes a python file and trys to import cubit
RUN printf 'import sys\nsys.path.append("/opt/Coreform-Cubit-2021.5/bin/python3/")\nimport cubit\ncubit.init([])\n' >> test_cubit_import.py

I’ve attached our centos 7 dockerfile that we use for GUI testing.
CubitDockerfile.zip (1.0 KB)
It exposes a VNC port (6080) you can attach to in your browser by going to localhost:6080 when you run the container with a 6080:6080 port mapping.

1 Like

Thanks very much Scot, this is most interesting. I’m going to see if I can move the rest of my software stack into centos:7

Also I think I just noticed my mistake in the python path appending

RUN printf 'import sys\nsys.path.append("/opt/Coreform-Cubit-2021.5/bin/python3/")\nimport cubit\ncubit.init([])\n' >> test_cubit_import.py

Should be

RUN printf 'import sys\nsys.path.append("/opt/Coreform-Cubit-2021.5/bin/")\nimport cubit\ncubit.init([])\n' >> test_cubit_import.py

It doesn’t have to be centos 7, that same solution should more or less work in other flavors of linux as well. That’s just what we test on for compatibility reasons.

Thanks, I can confirm I’ve got Cubit working inside a Debian 10.10 and Ubuntu 21.04 Docker container now. Thanks for the help

Hey All !

Thanks to @jshimwell for the tutorial on how to containerize Trelis.

We had problems with the graphical interface when running an old Trelis (Trelis-16.5.4) on a recent Fedora OS (FedoraCore 38). Without the GUI / via the python interface it worked as expected. Curiously, the even older Trelis-15.1 runs (with GUI) without any problems at all.

The error messages we got were related to “QOPENGLWidget” and “QXcbConnection”.

We decided to setup a singularity container and run Trelis-16.5.4 inside that container.
Our approach is based on the one posted above with some tweaks.

We install Trelis inside the container at the location /group/programs64/

The recipe we used to create the singularity container: centos7-trelis.recipe

# to build use: singularity build --sandbox ./centos7-trelis.ssb ./centos7-trelis.recipe
# to run: singularity run /path/to/centos7-trelis.ssb

BootStrap: docker
From: centos:7

%labels
        Maintainer name@group.com

%setup
        mkdir -p ${SINGULARITY_ROOTFS}/group

%help
        A baseline container for Trelis on CentOS 7

%environment
        LC_ALL=C
        LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:/usr/lib64:/usr/lib:/lib64:/lib
        TZ='Europe/Berlin'
        alias ll='ls -l'
        export LC_ALL LD_LIBRARY_PATH TZ

%post
        yum update -y

        # Install basic package (such as editor)
        yum install -y  wget \
                        xz-utils \
                        cmake \
                        vim \
                        less \
                        curl

        # Necessary libs
        yum install -y  mesa-libGL
        yum install -y  mesa-libGLU
        yum install -y  gtk2
        yum install -y  GConf2
        yum install -y  alsa-lib
        yum install -y  libSM
        yum install -y  libXt
        yum install -y  libXmu
        yum install -y  tcp_wrappers-libs
        yum install -y  PackageKit-gtk3-module
        yum install -y  libcanberra-gtk2

        # install dependencies
        yum install -y libX11
        yum install -y xcb-util-wm
        yum install -y xcb-util-image
        yum install -y xcb-util-keysyms
        yum install -y xcb-util-renderutil
        yum install -y libxkbcommon-x11
        yum install -y libglvnd-opengl

        # install cubit utilizing the rpm package from the coreform website
        rpm -i "https://f002.backblazeb2.com/file/cubit-downloads/Coreform-Cubit/Releases/Linux/Trelis-16.5.4-Lin64.rpm" --prefix=/group/programs64/Trelis-16.5.4/ 

        # setup license file (we use a floating license, hosted on the server hostname.domain.com, accessible via port 5051)
        echo -e "HOST hostname.domain.com ANY 5051\nISV csimsoft\n" >> /group/programs64/Trelis-16.5.4/bin/licenses/remote.lic

# when the singularity container is "run" the following runscript is executed (inside the container)
%runscript
        /group/programs64/Trelis-16.5.4/bin/trelis

Further notes:

  • you may need allow the singularity container to connect to X: xhost +
  • we used singularity-ce-4.0.0 to build and run the container: Quick Start — SingularityCE User Guide 4.0 documentation
  • probably not all the libraries listed above are necessary
  • you probably need to adjust the recipe above to meet your needs

Hopefully this is helpful to someone struggling with an old Trelis or Cubit version.

Best,
Lukas