Skip to content
Advertisement

Build Docker Image with Java and Node.js together (Error : java: not found )

I’ve an API application that run both node and java files(jar) together. When I run the application locally it works, but once I create a docker image for it, I got an error from the postman .

  parsingError: Command failed: java -jar Binary***.jar -s Files*** -v -j
/bin/sh: 1: java: not found 

I believe that I’m missing the jave configuration in docker file but I don’t know how to put the configuration for java and node together. any help will be appricatited!

Here is the Docker config.

FROM node:14.18.1

WORKDIR /code

ENV PORT 3000

COPY package.json /code/package.json

RUN npm install

COPY . /code

CMD ["node","app.js"]

Note: I’m using Temurin JDK

Advertisement

Answer

Maybe inside node:14.18.1 there is no java installed.

You have to add another step inside dockerfile:

RUN apk update && apk add openjdk(versionjdk)

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement