-
First you need
docker
,brew
,XQuartz
andsocat
on your host. -
Now run this in new terminal :
socat TCP-LISTEN:6000,reuseaddr,fork UNIX-CLIENT:\"$DISPLAY\"
This command is going to use
socat
to make a unix socket (which is made by XQuartz to make X server) to tcp redirection/conversion . In this way you can access your xserver on your local network.6000
is default xserver tcp port for listening. To findout more about used flags you can refer to here. Now leave current terminal open and go to next step. -
In new terminal window enter following commands & hit enter one by one :
IP=$(ifconfig en0 | grep inet | awk '$1=="inet" {print $2}')
With this commnad you are going to extract your host ip address from
en0
network interface by ifconfig utility and assign it to newIP
variable. if you typeecho $IP
you can seeIP
variable content.xhost + $IP
xhost
program is used to add your ip address to the list of allowed sources to make connections to the xquartz X server.docker run -it --rm --privileged --net=host -e DISPLAY=$IP:0 -v /tmp/.X11-unix:/tmp/.X11-unix openmodelica/openmodelica:v1.14.1-gui OMEdit
This is last command which is going to run OpenModelica docker image . after you hit enter docker will pull openmodelica/openmodelica version
1.14.1
image from docker hub and run it interactivly by attaching your shell to the running container (-it
) and pass your host ip address as a environment variable by naming itDISPLAY
and using docker-e
flag. It also mounts your local x server unix socket (/tmp/.X11-unix
) to the container with-v
flag. At the end it will runOMEdit
from container file system. If you stop container by any means (e.g hitingctrl+c
) docker will delete your container (--rm
).
Last active
August 23, 2024 14:24
-
-
Save matinrco/6a11baed1c2f19b27656170783ddf380 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For those who end up here, if you have more questions join the Discord channel for Modelica Language