How to build a Docker Image in Matlab with Additional Packages

8 vues (au cours des 30 derniers jours)
Rahul Sivagaminathan
Rahul Sivagaminathan le 22 Fév 2024
Commenté : Kojiro Saito le 12 Mar 2024
I have a function that works. I am able to dockerize it without adding additional packages, but when i add additional packages i get error messages.
mpsResults = compiler.build.productionServerArchive ('DockerFunction_ToTest_Reading_Inserting_Into_AWS.m')
compiler.package.microserviceDockerImage(mpsResults,'ImageName','dockertotestconnectiontoaws','AdditionalPackages',"postgresql-42.7.0.jar")
I have 2 questions - 1) What path does Matlab expect my JAR file to be in, it is in the current (pwd) director 2) How can i mention specific path in the above command ?
I tried the following variations of adding the Additional Package none worked -
compiler.package.microserviceDockerImage(mpsResults,'ImageName','dockertotestconnectiontoaws','AdditionalPackages','postgresql-42.7.0.jar')
compiler.package.microserviceDockerImage(mpsResults,'ImageName','dockertotestconnectiontoaws','AdditionalPackages','\\gcnms101.ds.givaudan.com\HomeDirL$\sivar\Documents\Rahul\ATOM 3\Mfiles New\ATOM 3 APIs\postgresql-42.7.1.jar')
compiler.package.microserviceDockerImage(mpsResults,'ImageName','dockertotestconnectiontoaws','AdditionalPackages','C:\Program Files\MATLAB\R2023a\java\jar\postgresql-42.7.0.jar')
compiler.package.microserviceDockerImage(mpsResults,'ImageName','dockertotestconnectiontoaws','AdditionalPackages','C:/Program Files/MATLAB/R2023a/java/jar/postgresql-42.7.0.jar')
compiler.package.microserviceDockerImage(mpsResults,'ImageName','dockertotestconnectiontoaws','AdditionalPackages',"./postgresql-42.7.0.jar")
compiler.package.microserviceDockerImage(mpsResults,'ImageName','dockertotestconnectiontoaws','AdditionalPackages',"postgresql-42.7.0.jar")
compiler.package.microserviceDockerImage(mpsResults,'ImageName','dockertotestconnectiontoaws','AdditionalPackages',"C:/Program Files/MATLAB/R2023a/java/jar/postgresql-42.7.0.jar")
compiler.package.microserviceDockerImage(mpsResults,'ImageName','dockertotestconnectiontoaws','AdditionalPackages',"C:/Rahul/postgresql-42.7.0.jar")

Réponse acceptée

Kojiro Saito
Kojiro Saito le 23 Fév 2024
You can add additional files with AdditionalFiles of compiler.build.ProductionServerArchiveOptions.
functionFile = 'DockerFunction_ToTest_Reading_Inserting_Into_AWS.m';
opts = compiler.build.ProductionServerArchiveOptions(functionFile, 'AdditionalFiles', 'postgresql-42.7.2.jar');
buildResults = compiler.build.productionServerArchive(opts);
compiler.package.microserviceDockerImage(buildResults);
  5 commentaires
Rahul Sivagaminathan
Rahul Sivagaminathan le 7 Mar 2024
Hi @Kojiro Saito I have one more question that my IT team wants to know. The dockerized image created by matlab can they run in a unix environment ? Or only in linux environment ? I am checking the help documents it seems Matlab create dockerized containers will only run on linux, windows and mac environments and not unix, is this correct ? Is there some workaround to make the containers run in a unix environment ?
Thanks for all your help and your time.
Kojiro Saito
Kojiro Saito le 12 Mar 2024
MATLAB Docker container images are Ubuntu based and you can run them from Linux, Mac and Windows environment. It may run but we don't test on Unix.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Compiler SDK dans Help Center et File Exchange

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by