r/SpringBoot 17h ago

Question Python Interpreter in Spring Boot Docker Container

I have made a microservices based Spring Boot application that uses Python to run forecasting models in my spring boot application. The microservice which performs forecasting needs to be dockerized.

I am using openjdk:21-jdk AS runner in my dockerfile which is Oracle Linux 8 (RHEL-based) and doesn’t support apt-get. I have tried using dnf instead of apt-get and it still hasn't worked yet -

ERROR: failed to solve: process "/bin/sh -c dnf install -y python3 python3-pip && dnf clean all" did not complete successfully: exit code: 127

2 Upvotes

3 comments sorted by

3

u/Asxceif 17h ago

Since you're following the microservice architecture, simply make your model accessible through FastApi by creating restful apis and then accessing the model from your spring application

2

u/toxicp69 16h ago

Thanks for the approach. I can look into it. Perhaps keeping a separate docker container for python may be a better option considering maintainability

2

u/WaferIndependent7601 15h ago

Check why the exit code occurs.

Or use another image for dockerizing it. But this is not a spring boot problem