I am running a Docker container on my system with a Spring Boot application, but I am getting "empty reply from server" messages when trying to curl to localhost:8080
, 0.0.0.0:8080
or myipaddress:8080
. I am new to Docker and I don't know why the server isn't responding. docker ps
shows the following:
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
5ff52ba449fd springio/test "java -jar /app.jar" 2 hours ago Up 2 hours 0.0.0.0:8080->8080/tcp eloquent_hertz
Docker command to run:
docker run -p 8080:8080 springio/test
My Dockerfile
:
FROM openjdk:8-jdk-alpine
ARG JAR_FILE=target/*.jar
COPY ${JAR_FILE} app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
Your Dockerfile
seems to be correct. I quickly tested it out with a simple springboot application, and it worked fine. I would assume this problem comes from the application itself. Have you defined a mapping inside your application for the endpoint your curling to? so @GetMapping("/")
or something similar?
What does your browser say when you open localhost:8080?
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.