matlab-dockerfile icon indicating copy to clipboard operation
matlab-dockerfile copied to clipboard

Cannot start X session after having used VNC

Open GuzTech opened this issue 2 years ago • 3 comments

Hello,

I have followed the instructions on the MATLAB docker hub and pulled MATLAB r2021b successfully. I can use it with an X session which works just fine. Since I need to install several toolboxes, I followed this guide which requires using a VNC session. After installing all the toolboxes I created a new commit without shutting down the docker image. After the commit I shut down the container using docker stop <container>.

However, now I am not able to start MATLAB using an X session anymore as it always defaults to using VNC, even without the -vnc option when starting the container. It looks like the VNC option is also committed and I cannot figure out how to "unset" this.

EDIT: I noticed that whenever I run docker without the -vnc option, docker ps still reports the command as /bin/run.sh -vnc. So this option seems "stuck".

GuzTech avatar May 03 '22 09:05 GuzTech

I have worked around this problem by creating a Dockerfile with the contents:

FROM fullmatlab:r2021b

CMD ["matlab"]

where fullmatlab:r2021b is the committed container I mentioned in the OP. Then I built a new container:

docker build -t matlabwithtoolboxes .

So now I just run:

docker run -it --rm -e MLM_LICENSE_FILE=27000@licenseserver -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro --shm-size=512M matlabwithtoolboxes

I am leaving this issue open because the behavior in the OP is not resolved, but I just wanted to post a workaround for people that run into the same problem.

GuzTech avatar May 03 '22 10:05 GuzTech

I get: pull access denied for fullmatlab, repository does not exist or may require 'docker login': denied: requested access to the resource is denied, any ideas how to solve that?

JSStabl avatar Jul 18 '22 15:07 JSStabl

@JSStabl - The container fullmatlab:r2021b referred to by @GuzTech only exists on their machine - it is NOT something that has been pushed to dockerhub (which is why you can't pull it). It was made using the instructions above.

josmartin avatar Jul 19 '22 08:07 josmartin

Dear @GuzTech

One can update the entrypoint used during the commit operation using the --change flag as described in the documentation for docker commit

So, when you create the commit after you install the toolboxes you could use the following syntax:

$ docker commit --change 'ENTRYPOINT ["/bin/run.sh"]' 35674d1376f0 matlabwithtoolboxes:r2021b

In the command above, please replace 35674d1376f0 with the CONTAINER ID of the container that you want to commit.

This should reset the newly created image to have the additional toolboxes that you have already installed using the VNC option while resetting the container to its original state.

For example, I can now run this container with a -browser flag as shown below:

$ docker run -it --rm --init --shm-size=512M -p 8888:8888 matlabwithtoolboxes:r2021b -browser
----------------------------------------------------
Welcome to the MATLAB Container

This container includes commercial software products of The MathWorks,
Inc. ("MathWorks Programs") and related materials. MathWorks Programs are
licensed under the MathWorks Software License Agreement, available in the
MATLAB installation in this container. Related materials in this
container are licensed under separate licenses which can be found in
their respective folders.

Use the -help flag to learn more about the usage of this container:

    docker run mathworks/matlab:r2021b -help

To access MATLAB running in the container via web browser, make sure you have exposed port 8888.
To get started:

    Point a browser to port 8888 of the docker host machine running
    this container

    http://hostname:8888/index.html

If want to launch MATLAB on a different base url, you need to set MWI_BASE_URL environment variable. 
`MWI_BASE_URL`: Default value is '/'. The url at which MATLAB will be accessible at. 
                Must start with '/'. If set to "/matlab", the url to access MATLAB would be:
                `http://hostname:8888/matlab/index.html`

For a complete list of environment variables, check the link below:
https://github.com/mathworks/matlab-proxy/blob/main/Advanced-Usage.md

If you require assistance or have a request for additional features or capabilities, please contact MathWorks Technical Support: https://www.mathworks.com/support/contact_us.html
----------------------------------------------------
INFO:MATLABProxyApp:
==============================================================================================================================
                                                  MATLAB can be accessed at:                                                  
                                                     http://0.0.0.0:8888                                                      
==============================================================================================================================

prabhakk-mw avatar Feb 27 '23 13:02 prabhakk-mw

@prabhakk-mw I have noticed that /bin/run.sh is no longer available in r2024a. So how does one start the -vnc and -browser now? Thanks.

matifali avatar May 14 '24 16:05 matifali

@prabhakk-mw I have noticed that /bin/run.sh is no longer available in r2024a. So how does one start the -vnc and -browser now? Thanks.

Hi @matifali

I just verified that the latest version of mathworks/matlab:r2024a does infact have run.sh available and on the path.

SmartSelect_20240514_220936_Termius.jpg

Could it be that you are looking for run.sh in the r2024a image built from matlab-dockerfile ?

Images built from the Dockerfile in this repository will not have that command available.

prabhakk-mw avatar May 14 '24 16:05 prabhakk-mw

Could it be that you are looking for run.sh in the r2024a image built from matlab-dockerfile ?

Yes. Could you link a Dockerfile that have everything?

matifali avatar May 14 '24 17:05 matifali

Could it be that you are looking for run.sh in the r2024a image built from matlab-dockerfile ?

Yes. Could you link a Dockerfile that have everything?

@matifali , The Dockerfile that builds mathworks/matlab with the implementations is on the plan to be released in the near future.

Would you please create an issue requesting for the same? I'd be happy to udpate that issue when the Dockerfile is released.

Thanks!

prabhakk-mw avatar May 14 '24 17:05 prabhakk-mw