[英]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:8380
或192.168.99.100:8082
这样访问
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.