Home > Blockchain >  How to install addons for Matlab from docker image using X11
How to install addons for Matlab from docker image using X11

Time:03-31

I have the latest docker image of MATLAB specifically this one Docker Matlab.

Then I tried running it with X11 and it worked as expected, to do that I used the following command:

sudo docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro --shm-size=512M mathworks/matlab:latest

Now I tried to install the Bioinformatics add-on and as soon as I clicked Install, MATLAB shut down (as expected) and a new window poped up for a brief second but then the docker container just stopped.

Some other info:

I use the latest version of docker and I'm running Arch with Gnome.

I expected that as soon as I hit the install button MATLAB should restart and start setting up the add-on.

CodePudding user response:

In all containers, when the default command finishes, the container stops.

In this case MATLAB is the default command and so when it exited, so did the container.

Try changing the default command to start bash shell, e.g.

sudo docker run -it --rm -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro --shm-size=512M mathworks/matlab:latest bash

And then start MATLAB from that shell. Now when MATLAB exits the shell remains running and so does the container.

Take a look at https://www.mathworks.com/help/cloudcenter/ug/save-changes-in-containers.html to see how to save your modified container so you don't need to install the add-on everytime.

  • Related