Skip to content

olberger/docker-modelio

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

olberger/docker-modelio

Introduction

Modelio 5.1.0 in a docker container (for Linux, and maybe for macOS too)

The image uses X11 unix domain socket on the host to enable display of the Modelio desktop app. These components are available out of the box on pretty much any modern linux distribution.

OpenJDK 11 is installed, inside the container in /usr/local/openjdk-11 (for use in Java Designer module's parameters).

WARNINGS

  • Once Launched :
    • The host shares X11 socket and IPC with the container => This breaks container isolation, and the contained app can listen to all X11 events !
    • The host shares your ~/.modelio/ and ~/Documents/ModelioWorkspace/ folders (by default) with the container.
  • Use it at your own risk !

Getting started

Requirements

Installation

Automated builds of the image are available on Dockerhub and is the recommended method of installation.

docker pull olberger/docker-modelio:5.1

Alternatively you can build the image yourself, from the contents of the Github repo.

docker rmi olberger/docker-modelio:5.1
docker build -t olberger/docker-modelio:5.1 github.com/olberger/docker-modelio#5.1

With the image locally available, install the wrapper script by running the following as root:

docker run -it --rm \
  --volume /usr/local/bin:/target \
  olberger/docker-modelio:5.1 install

This will install a wrapper script named modelio-wrapper-5.1 to launch Modelio inside a container (details and options below).

Setup on Mac (perform once)

THIS SECTION WASN'T TESTED AND SHOULD BE CHECKED. PULL REQUESTS WELCOME

  1. launch XQuartz
  2. in Preferences -> Security check "Authenticate connections" and "Allow connections from network clients"
  3. exit and re-launch XQuartz
  4. clone this repository (NOT YET UPDATED SINCE I HAVE NO MAC TO TEST MY REPO'S)
    git clone https://github.com/olberger/docker-modelio
  5. enter the repository
    cd docker-modelio
  6. build (optional, to specify architecture for M1 (apple silicon) macOS.)
    docker build --platform linux/amd64 --tag olberger:docker-modelio:5.1 .
  7. enable the run.sh script to be run
    chmod +x run.sh

Starting Modelio

On Linux

Launch the modelio-wrapper-5.1 script to enter a shell inside the Docker container (or directly modelio if you don't have multiple versions installed):

modelio-wrapper-5.1 bash

Then the prompt should be displayed like:

Cleaning up stopped instances of the modelio container...
Using MODELIO_HOME: /home/olivier
Mounting '/home/olivier/Documents/ModelioWorkspace' on the host into '/home/modelio/modelio/workspace' on the guest
Limiting to 2.0 cpus for the container
Starting bash inside the container...
Inside the running container...
You can now launch Modelio 5.1 by invoking '/usr/bin/modelio-open-source5.1' at the bash prompt, and quit with 'exit' at the end.
modelio@9749358c4a9d:~$ 

then type /usr/bin/modelio-open-source5.1 at the prompt inside the container, as instructed.

On MacOS

./run.sh

Which displays:

TBD

Runtime options

There are a number of options available

$ modelio-wrapper -h

Launch modelio using:
 modelio-wrapper [options] bash

OPTIONS:
   -c NB_CPUS                       Limit to NB_CPUS the CPU usage (default: 2.0, 0: unlimited)
   -p MODELIO_HOME                  Specify a prefix for host directories mounted inside the container (default: $HOME)
   -h                               Show this message
  • -c NB_CPUS: allows controlling the number of cpus the container may use (docker's --cpus option). By default, set to 2.0. Unlimited use can be specified bt passing -c 0.
  • -p MODELIO_HOME: allows specifying a path under which to set the path of the directories used to share data between host and guest. By default, it will be set to $HOME, i.e. sharing directories $HOME/Documents/ModelioWorkspace/ and $HOME/.modelio/ with the guest. As an alternative, one may set the MODELIO_HOME env var.

Maintenance

Updating

To update to a newer release of the container image, for Modelio 5.1:

  1. Download the updated Docker image:
docker pull olberger/docker-modelio:5.1
  1. Run install to make sure the host scripts are updated.
docker run -it --rm \
  --volume /usr/local/bin:/target \
  olberger/docker-modelio:5.1 install

Upgrading

To update to a release of the container image for a later version of Modelio, check the repository's master branch instructions.

Running previous versions

See https://github.com/olberger/docker-modelio/tree/4.1 for instructions on running a container for Modelio 4.1.

Running multiple versions alongside in separate containers should be possible, but test this at your own risks.

Uninstallation

docker run -it --rm \
  --volume /usr/local/bin:/target \
  olberger/docker-modelio:5.1 uninstall

Local image rebuild

docker build --tag  olberger/docker-modelio:5.1 .

Run without installation

For debugging purposes, one may run directly the wrapper script without installing it in /usr/local/bin.

./scripts/modelio-wrapper bash

Performance issues

Due to performance issue with GTK3 (or another strange Java runtime issue), the docker run command launched by the wrapper limits CPU usage. On a host with 8 cores (lscpu command), here follows the behaviour with some values of CPU usage:

  • 1.5 (core) : too slow, unusable
  • 2.0 : slow (default)
  • 3.0 : convenient
  • 4.0 : comfortable

Adjust the -c option passed to the modelio-wraper-5.1, depending on your needs.

Contributing

If you find this image useful here's how you can help:

  • Send a pull request with your awesome features and bug fixes
  • Help users resolve their issues.

How it works

The wrapper scripts mounts the X11 socket in the launcher container (a Docker volume). The X11 socket allows for the user interface display on the host.

When the image is launched the following directories are mounted as volumes:

  • ~/.modelio-5.1/, or ${MODELIO_HOME}/.modelio-5.1/ if option -p is provided, or a value of MODELIO_HOME is defined
  • ~/Documents/ModelioWorkspace/ (where Documents is determined through XDG_DOCUMENTS_DIR), or similarly ${MODELIO_HOME}/Documents/ModelioWorkspace/

This makes sure that the configuration of the tool are stored on the host and files saved are preserved in the user's home on the host, if placed inside the special 'ModelioWorkspace/' subdirectory.

Don't want to expose standard host's folders to Modelio application?

Either set a global MODELIO_HOME environment variable to namespace all modelio folders, or use the -p option to the wrapper script:

mkdir -p ${HOME}/modelio-guest/
export MODELIO_HOME=${HOME}/modelio-guest

Sources / inspiration

About

Modelio 5.1 in a docker container

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Shell 83.8%
  • Dockerfile 16.2%