Home > Software engineering >  Error creating Docker container for a microservice app in Springboot in Ubuntu
Error creating Docker container for a microservice app in Springboot in Ubuntu

Time:02-14

I am trying to create a Docker container for a micro-service in SpringBoot Java in Ubuntu 21.10, but when I try to build the container I get this error, maybe it is a common error, but so far I can't solve it, I have checked some posts on Internet but had no luck finding a similar solution. Please I would really appreciate the help! Thank you in advance

This is my Dockerfile:

FROM ubuntu
RUN yum install -y java
VOLUME /tmp
ADD target/microservice-0.0.1-SNAPSHOT.jar app.jar
RUN sh -c 'touch /app.jar'
ENTRYPOINT ["java", "-Djava.security.egd-file:/dev/./urandom","-jar","/app.jar"]

This is the error I get:

 docker build -t spring_boot_docker .
 
 Sending build context to Docker daemon  17.72MB
 Step 1/6 : FROM ubuntu
 ---> 54c9d81cbb44
 Step 2/6 : RUN yum install -y java
 ---> Running in a2793e79925b
 /bin/sh: 1: yum: not found
 The command '/bin/sh -c yum install -y java' returned a non-zero code: 127

CodePudding user response:

In ubuntu you can try installing with apt-get:

RUN apt-get update && \
    apt-get install -y openjdk-8-jdk
  • Related