简体   繁体   English

访问Spring Boot应用程序拒绝与docker工具箱中运行的IP 192.168.99.100连接

[英]Accessing Spring boot Application refused to connect with IP 192.168.99.100 running in docker tool box

I am running a spring boot application in docker tool box. 我正在docker工具箱中运行spring boot应用程序。 The application runs on port 8380 as set in application properties. 应用程序在应用程序属性中设置的端口8380上运行。 However, when i run its image in a container, I am publishing with ports 8380:8082. 但是,当我在容器中运行其映像时,我正在使用端口8380:8082发布。 When i access it from ip 192.168.99.100 (my docker machine ip) and port 8380, it gives me ERR_CONNECTION_REFUSED error. 当我从IP 192.168.99.100(我的docker计算机IP)和端口8380访问它时,它给了我ERR_CONNECTION_REFUSED错误。 192.168.99.100 refused to connect. 192.168.99.100拒绝连接。

Any ideas what might be wrong? 任何想法可能有什么问题吗?

I have tried using localhost instead of docker-machine ip. 我尝试使用localhost而不是docker-machine ip。 I checked the access url from kitematic ie 192.168.99.100:8380. 我检查了kitematic的访问URL,即192.168.99.100:8380。 Using this it does not work. 使用它是行不通的。

Here is my DockerFile: 这是我的DockerFile:

FROM java:8
EXPOSE 8082
ADD /build/libs/tsi-csrportal-gui-2.0-SNAPSHOT.jar dockerDemoCsrportal.jar
ENTRYPOINT ["java", "-DTSI_APP_NAME=csrportal", "-DTSI_ENV=test", "-Dtsi.log.console", "-jar", "dockerDemoCsrportal.jar"]

I expect the service to give json response when I access with the proper endpoint. 当我使用适当的端点访问时,我希望该服务能够给出json响应。 Similar to when I run the spring boot application without docker toolbox. 类似于我在没有docker工具箱的情况下运行spring boot应用程序时的情况。 (Only change is that now I use docker machine ip instead of using localhost) (唯一的变化是现在我使用docker machine ip而不是localhost)

When you expose a port in docker it means you can access to that container using [container_ip]:[exposed_port] . [container_ip]:[exposed_port]公开端口时,意味着您可以使用[container_ip]:[exposed_port]访问该容器。
But when you map the exposed port to another port it means that you can access to the container using [host_ip]:[mapped_port] . 但是,当您将裸露的端口映射到另一个端口时,这意味着您可以使用[host_ip]:[mapped_port]访问该容器。
So you can access like localhost:8380 or 192.168.99.100:8082 因此您可以像localhost:8380192.168.99.100:8082这样访问

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 连接被拒绝:访问在Docker容器中运行的Spring Boot应用程序 - Connection refused: accessing a spring boot application running in docker container 连接拒绝尝试连接 spring 在 docker 启动应用程序 - Connection refused trying to connect spring boot application in docker Spring Boot docker无法连接到mysql(连接被拒绝/ createCommunicationsException) - Spring boot docker Cannot connect to mysql (Connection refused / createCommunicationsException) 无法使用 Spring Boot 应用程序连接到 docker 映像 - Not able to connect to docker image with a spring boot application Spring 启动应用程序无法连接到 mariadb(在 Docker 中) - Spring boot application unable to connect to mariadb (in Docker) 无法加载 Spring 在 Docker 中运行的引导应用程序 - Unable to load Spring Boot application running in Docker Spring 引导 MySQL Docker ConnectException:连接被拒绝 - Spring Boot MySQL Docker ConnectException: Connection refused 在Spring Box应用程序的Virtual Box上运行WAR时出现错误 - Getting Error when running WAR on Virtual Box for Spring Boot Application 通过 Spring 启动应用程序连接到 Docker Compose MongoDb - Connect To Docker Compose MongoDb Via Spring boot application Docker 中的 Postgres 服务器无法连接到 spring 启动应用程序 - Postgres Server in Docker cannot connect to spring boot application
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM