[英]Docker container running Spring Boot application not answering requests
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 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 的新手,我不知道为什么服务器没有响应。
docker ps
shows the following: docker ps
显示如下:
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命令运行:
docker run -p 8080:8080 springio/test
My Dockerfile
:我的
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.您的
Dockerfile
似乎是正确的。 I quickly tested it out with a simple springboot application, and it worked fine.我用一个简单的 springboot 应用程序快速测试了它,它运行良好。 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?所以
@GetMapping("/")
或类似的东西?
What does your browser say when you open localhost:8080?当您打开 localhost:8080 时,您的浏览器会显示什么?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.