- Input Argument - The simplest way to pass basic data like strings, is to take this data as an input argument for the function. Refer to the documentation for examples of how to package and run functions as Docker containers with input arguments.
- Mounted Volume - You can mount volumes to a container at runtime to make files available to the code within the container. See the Docker documentation for how to mount a volume. Note that the packaged code runs as a low-permission user in the container by default, so ensure the user specified by ContainerUser has access to any necessary files.
- Secrets - Sensitive strings, such as tokens or access keys, can be stored and accessed from your packaged code using MATLAB secrets. See the documentation for more details.
- Environment Variable - You can use the -e flag to pass environment variables to a Docker container at runtime. See the Docker documentation for more details.
How can I pass data to a Docker container packaged with MATLAB Compiler?
조회 수: 2 (최근 30일)
이전 댓글 표시
MathWorks Support Team
2025년 6월 30일
답변: MathWorks Support Team
2025년 6월 30일
I am using MATLAB Compiler to package a function as a Docker container. My function uses an access token to access files on the cloud, which works fine in base MATLAB. This token can be a string, environment variable, file, etc. as needed.
However, I don't know how to make this token string available to the function when it runs as a Docker container. How can I pass this data to my code?
채택된 답변
MathWorks Support Team
2025년 6월 30일
There are several options for passing files, strings, secrets, etc. to a packaged Docker container.
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Containers에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!