Docker Mounted Volume not Writable

16 views (last 30 days)
Stephen Dame
Stephen Dame on 15 Feb 2022
Answered: Ninad on 18 Jan 2024
When running Matlab/Simulink from a m-file script in a docker container the Matlab wrapper environment seems to prevent writing to the mounted file system. Is there a command line option (from MathWorks) that enables that?

Answers (1)

Ninad
Ninad on 18 Jan 2024
Hi Stephen,
As per my understanding, you are attempting to run MATLAB/Simulink using a script within a Docker container and facing issues while writing to the host's mounted filesystem from within the container, and you wish to enable the MATLAB environment within the Docker container to write to the mounted volume, which is a directory on the host machine that has been made accessible to the container.
You can use a prebuilt MATLAB container image available on Docker Hub (https://hub.docker.com/r/mathworks/matlab).
Refer this MATLAB Documentation to access MATLAB using pre-built MATLAB container image: https://in.mathworks.com/help/cloudcenter/ug/matlab-container-on-docker-hub.html
To share data with a container, you can mount folders in the host system to the container using the "-v" Docker option.
For example, the following option mounts the source folder "MyFolder" and its subfolders to a target folder in the container, "ContainerFolder"
-v /MyFolderPath/MyFolder:/home/matlab/Documents/MATLAB/ContainerFolder
Add this option when you execute the "docker run" command.
For more information on sharing data with containers, please see the following MATLAB documentation: https://in.mathworks.com/help/cloudcenter/ug/share-data-with-containers.html
Hope this helps.
Regards,
Ninad

Categories

Find more on Containers in Help Center and File Exchange

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!