Running "sudo matlab" in docker container causes the majority of processes to crash

37 views (last 30 days)
Dear all,
As I'm trying to set up a matlab 2022b container with ros toolbox installed, I'm trying to run matlab through the sudo matlab command to enable the add-on installation interface (see https://nl.mathworks.com/matlabcentral/answers/1870902-install-parallel-computing-toolbox-in-matlab-docker for the reason). Unfortunately the majority of the container processes are killed (including the vnc server) once I run this command.
Steps I take are:
1. set up docker
docker run -it -p 5901:5901 -p 6080:6080 --shm-size=512M -v /Users/username/somefolder:/data --name=MatlabContainer mathworks/matlab:r2022b -vnc
Note this is not based on the suggested initial docker container commaned from https://hub.docker.com/r/mathworks/matlab.
2. use web browser (safari) to access vnc view of container
localhost:6080
3. start a terminal
4. start matlab through
sudo matlab
At this point I see the matlab loader splash screen, followed by a loss of connection to the VNC server in the container
If I track the active processes during this period (after running sudo matlab), i see the process as attached in the images to this post.
Double-checking the assertion that I need to run matlab in sudo mode to use the add-on installer in the container (again, see https://nl.mathworks.com/matlabcentral/answers/1870902-install-parallel-computing-toolbox-in-matlab-docker), I've run matlab through the vnc interface to the desktop (double click), as well as by executing either
matlab
or
sudo -u matlab matlab % to invoke sudo, while running through the default username "matlab", to run matlab
Both methods do not allow succesful loading of the add-on browser.
Because I've not been able to find a way to download the ros toolbox as a standalone file (thank you mathworks website), I havent' been able to apply the alternative approach of manual toolbox installation listed at (https://nl.mathworks.com/matlabcentral/answers/1870902-install-parallel-computing-toolbox-in-matlab-docker).
Any help is very very much appreciated at this point.
P.S.
I organise the container through docker desktop v 4.17.0, and run all of it on a 2021 apple macbook air running Venture 13.2.1 with M1 processor and 16 GB of ram, of which I've allocated 4 of the 8 cores and 8 GB to the docker desktop program. As I understand it, that means the virtual machine that all docker containers run inside (due to mac OS) may use up to 4 cores and 8 GB max. So far, keeping an eye on my utilization, I've not seen it saturate during this process.

Answers (2)

Prabhakar
Prabhakar on 27 Mar 2023
Could you please try to execute the following command from your terminal within the container, BEFORE attempting to launch MATLAB with the SUDO command:
xhost +local:
Please do let me know if this helps resolve the issue...
Thanks
  1 Comment
Caspar Hanselaar
Caspar Hanselaar on 27 Mar 2023
This does not resolve the issue, no change in behaviour can be observed after running the xhost +local: in a terminal, prior to executing sudo matlab in the same terminal

Sign in to comment.


Prabhakar
Prabhakar on 27 Mar 2023
Edited: Prabhakar on 27 Mar 2023
Based on the information in this question and your other thread, I gather you want to install the ROS toolbox and the Parallel Computing Toolbox into the mathworks/matlab:r2022b container.
I'm not sure why you are facing issues with the VNC approach, however could you please try building the attached Dockerfile to accomplish the desired setup.
Commands to run on your terminal:
#Ensures that latest image is pulled
docker pull mathworks/matlab:r2022b
#navigate to the directory in which you have Downloaded the provided Dockerfile
docker build -t matlab-with-ros:r2022b .
#run your container to verify that the desired toolboxes are present
docker run -it --rm matlab-with-ros:r2022b
Running matlab
MATLAB is selecting SOFTWARE OPENGL rendering.
Please enter your MathWorks Account email address and press Enter:
enter-your@mathworks-account-email.com
Single-Sign-On(SSO) is not available in this environment. You need a one-time password to sign in to MATLAB.
Step 1. Visit https://www.mathworks.com/mw_account/otp
Step 2. Copy the password.
Step 3. Return here, and input the password.
Please enter the one-time password:
475445
Starting MATLAB with license: 2352353
< M A T L A B (R) >
Copyright 1984-2022 The MathWorks, Inc.
R2022b Update 5 (9.13.0.2193358) 64-bit (glnxa64)
February 10, 2023
Warning: X does not support locale C
To get started, type doc.
For product information, visit www.mathworks.com.
>> ver
-----------------------------------------------------------------------------------------------------
MATLAB Version: 9.13.0.2193358 (R2022b) Update 5
MATLAB License Number: 40447121
Operating System: Linux 5.10.0-21-amd64 #1 SMP Debian 5.10.162-1 (2023-01-21) x86_64
Java Version: Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
-----------------------------------------------------------------------------------------------------
MATLAB Version 9.13 (R2022b)
Parallel Computing Toolbox Version 7.7 (R2022b)
ROS Toolbox Version 1.6 (R2022b)
Dockerfile:
FROM mathworks/matlab:r2022b
USER root
RUN export DEBIAN_FRONTEND=noninteractive && apt-get update && \
apt-get install --no-install-recommends --yes wget \
build-essential \
cmake && \
apt-get clean && apt-get -y autoremove && rm -rf /var/lib/apt/lists/*
WORKDIR /opt/matlab
RUN wget -q https://www.mathworks.com/mpm/glnxa64/mpm && \
chmod +x mpm && \
./mpm install --destination=/opt/matlab/R2022b/ --release=R2022b \
ROS_Toolbox Parallel_Computing_Toolbox \
|| (echo "MPM Installation Failure. See below for more information:" && cat /tmp/mathworks_root.log && false) && \
rm -f mpm /tmp/mathworks_root.log && \
ln -fs /opt/matlab/R2022b/bin/matlab /usr/local/bin/matlab
WORKDIR /home/matlab/Documents/MATLAB
USER matlab
Please let me know if this worked.
Thanks!

Categories

Find more on Containers in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!