简体   繁体   English

Docker 容器运行 Spring 引导应用程序未响应请求

[英]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.

相关问题 使用 Spring Boot 应用程序访问 postgres docker 容器 - Access postgres docker container with spring boot application 在docker容器中重新部署spring-boot应用程序? - Redeploy spring-boot application in docker container? Spring启动应用程序在IntelliJ中工作,但不是Docker容器 - Spring boot application working in IntelliJ, but not as Docker Container 无法加载 Spring 在 Docker 中运行的引导应用程序 - Unable to load Spring Boot application running in Docker Spring Boot、PostgreSQL 和 Docker - 在容器中运行时连接被拒绝 - Spring Boot, PostgreSQL, and Docker - Connection Refused whil Running in Container 如何从不同的 docker 容器中读取 spring 启动应用程序属性? - How to read spring boot application properties from a different docker container? 在 Docker-compose 中使用 Kafka 运行 Spring Boot 应用程序 - Running Spring Boot application with Kafka in Docker-compose 运行 Spring 启动应用程序 - Running Spring boot application 将pdf作为在docker容器中运行的spring应用程序的静态资源提供 - Serve pdf as static resource from spring application running in docker container 在Windows上使用Docker开发Spring Boot应用程序,但在Ubuntu VM上运行Docker容器(作为Docker主机) - Developing a spring boot application with docker on windows but run the docker container on a Ubuntu VM (as Docker Host)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM