Why can't I write to a (/tmp or /user_created) folder from inside a container using the microservice docker image example?

7 ビュー (過去 30 日間)
Arvind
Arvind 2025 年 4 月 23 日
回答済み: Linda 2025 年 4 月 25 日
I'm exploring the micro-magic microservice docker image example and was able to successfully the run the original example on localhost as well as on AWS. But as a next step, I modified it to write the results to a simple txt file using the following commands:
outputFile = '/tmpdata/dummy.txt'
fileID = fopen(outputFile,'w+');
fprintf(fileID, 'Output of MyMagic: \n');
fprintf(fileID,'%d %d %d %d \n', magic(x));
But, I'm seeing an error: Invalid file identifier. Use fopen to generate a valid file identifier.
I suspect I'm running into problems that are connected to the WRITE permissions to any folder within the container from the runtime. Any ideas on how to fix this, and enable writing to a local folder on the container?
Thanks.

回答 (1 件)

Linda
Linda 2025 年 4 月 25 日
@escape road city 2 the issue is likely due to write permission problems inside the Docker container—specifically, the path /tmpdata/dummy.txt may not exist, or your container doesn't have permission to write there.

カテゴリ

Help Center および File ExchangeCOM Component Integration についてさらに検索

製品


リリース

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by