Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Docker Instructions for Mac

Docker Instructions for Mac

Now when Mac OS is no longer supported with vanilla builds, I think it would great if you could provide a good start for how to get OMEdit up and running on Mac from your docker images on a Mac with XQuartz.
I would like to have the minimum set of commands required to start up the image and then from the terminal command line start OMEdit and get it to open the window in XQuartz.

The steps of installing docker and getting the images up and running are clear. Currently I can get the image up and running in a terminal and can run command line work with OMC but I would like to have GUI features to edit and play with models. I believe that my problem is: how to set up a working communication between the Container and the XQuartz X-server.

Re: Docker Instructions for Mac

I have now made some progress towards the vanilla steps, to get OMEdit. up and running in XQuartz under Mac and is reporting my steps here for future reference and possible inclusion in a simple guide.

Prerequisites: XQuartz is installed, and the docker desktop is installed and the docker image for openmodelica is downloaded (currently "openmodelica/openmodelica:v1.18.0-gui")
In XQuartz go to Preferences/Security and make sure that the box is ticked for "Allow connections from network clients".
Now we need to setup the ip address and grant access, as well as add the magic
Start a terminal and run:

Code:


ip=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
Xhost +$ip
docker run -it -v ~/.Xauthority:/root/.Xauthority -e DISPLAY=$ip:0  openmodelica/openmodelica:v1.18.0-gui /bin/bash

Now we have a bash terminal running interactively in the docker container.
Here we can test that the omc version is as assumed and we can run OMEdit that connects to XQuartz.

Code:


omc --version
OMEdit

And now I have got OMEdit up and running but some path variables etc for OpenModelica are missing for the standard libraries to load automatically, but that can be added to the "docker run ..." command.

Edited by: larer34 - Jul-31-22 12:55:13

Re: Docker Instructions for Mac

It seems you solved the issue! Very good. Thank you for the howto. I now added a link to it to the Mac download page.

Re: Docker Instructions for Mac

For Linux, I would often run something like:

Code:

 docker run -it --rm -e "HOME=$HOME" -e "DISPLAY=$DISPLAY" --network=host --user "$UID" -v "$HOME:$HOME" -v "$PWD:$PWD" -w "$PWD" openmodelica/openmodelica:v1.18.0-gui

So the home directory is not filled with root-owned files.

Edited by: sjoelund.se - Aug-01-22 13:35:36
There are 0 guests and 0 other users also viewing this topic