The example in "Create Microservice Docker Image" errors when running the image

7 visualizaciones (últimos 30 días)
I am following the example on https://se.mathworks.com/help/compiler_sdk/mps_dev_test/create-a-microservice-docker-image.html to create a docker image. When using the command for starting a container
docker run --rm -p 9900:9910 micro-magic
the container crashes with the following output:
1 [2024.12.11 07:29:00.242368] [information] Starting Microservice Runner (pid = 1)
2 [2024.12.11 07:29:00.242476] [information] Global locale: en_US
3 [2024.12.11 07:29:00.242496] [information] Global encoding: US-ASCII
4 [2024.12.11 07:29:00.242501] [information] terminal encoding: US-ASCII
12 [2024.12.11 07:29:00.611081] [information] configuring WebFunction router
13 [2024.12.11 07:29:00.611126] [information] -- (no routes file configured) Using XHeaderMatcher for WebFunction routing
24 [2024.12.11 07:29:00.931066] [error] [SERVICE:One CTF deployer] failed to deploy magicarchive to /opt/matlabruntime/R2024b
25 [2024.12.11 07:29:00.931125] [error] [SERVICE:One CTF deployer] Failed to start with error, code = 7, message = failed to deploy archive
26 [2024.12.11 07:29:00.931146] [error] [SERVICE:One CTF deployer] Failed to start; error=7 failed to deploy archive
28 [2024.12.11 07:29:00.931173] [error] [SERVICE:component deployment services] Failed to start; error=7 failed to deploy archive
77 [2024.12.11 07:29:00.931683] [error] Failed to start; error=7 failed to deploy archive
83 [2024.12.11 07:29:00.931813] [error] Failed to start; error=7 failed to deploy archive
92 [2024.12.11 07:29:00.931877] [error] [SERVICE:base services] Failed to start; error=7 failed to deploy archive
[Microservice Runner]
If I start a bash in the image using
docker run --rm -it -p 9900:9910 --entrypoint bash micro-magic
and then use
cd /opt/matlabruntime/R2024b/bin/glnxa64/
./muserve -a /usr/bin/mlrtapp/magicarchive.ctf
inside the container, the service starts as expected.
I am using Matlab R2024b on Windows, with Podman as a replacement for Docker (I cannot use Docker due to its license restrictions).
What can I do to make the service start via the normal entrypoint of the image?
  1 comentario
Sabrina
Sabrina el 12 de Dic. de 2024
My current workaround is the following: Create a file startup.sh with
#!/bin/bash
cd /opt/matlabruntime/R2024b/bin/glnxa64/
./muserve -a /usr/bin/mlrtapp/magicarchive.ctf
and edit the Dockerfile created by Matlab to include the file and use it as a command
# Dockerfile for image: micro-magic
#
# Sample docker build command:
# wsl docker build -f "Dockerfile" -t micro-magic "."
FROM matlabruntime/r2024b/release/update2/108000000000000000
RUN apt-get update && apt-get upgrade -y
COPY ./applicationFilesForMATLABCompiler /usr/bin/mlrtapp
COPY ./startup.sh .
RUN chmod -R a+rX /usr/bin/mlrtapp/*
RUN if ["$(getent passwd appuser | cut -d: -f1)" = ""] ; then useradd -ms /bin/bash appuser ; fi
USER appuser
ENV PATH=$PATH:/opt/matlabruntime/R2024b/bin/glnxa64
ENTRYPOINT ["bash"]
CMD ["startup.sh"]

Iniciar sesión para comentar.

Respuestas (1)

Kautuk Raj
Kautuk Raj el 18 de Dic. de 2024
I suggest trying to manually override the Docker image entry point by setting it to "/bin/bash". From within the resulting Docker container, run the "muserve" command to manually unpack the CTF archive containing your archived MATLAB functions.
Below is the representative change which can be made to the YAML file:
spec:
containers:
name: matlab-magic
image: matlab/micro-magic:1.0
command: ["/bin/bash", "-c"]
args:
- cd /opt/matlabruntime/R2022b/bin/glnxa64
./muserve -a /usr/bin/mlrtapp/magicarchive.ctf

Categorías

Más información sobre Microservices en Help Center y File Exchange.

Productos


Versión

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by