在Docker容器上运行时,没有找到HTTP请求的映射

Spring Security安装Spring Boot api到目前为止运行良好。

当我尝试从Docker容器运行api时遇到问题,当接收到像http:// localhost:8080 / api / v1 / h2-console /这样的请求时,我得到一个没有找到HTTP请求的映射。

这是直接在jvm上运行应用程序的日志一切正常:

2017-07-22 19:28:36.310 DEBUG 6235 --- [nio-8080-exec-1] osswaiFilterSecurityInterceptor : Authorization successful 2017-07-22 19:28:36.310 DEBUG 6235 --- [nio-8080-exec-1] osswaiFilterSecurityInterceptor : RunAsManager did not change Authentication object 2017-07-22 19:28:36.310 DEBUG 6235 --- [nio-8080-exec-1] ossecurity.web.FilterChainProxy : /h2-console/ reached end of additional filter chain; proceeding with original chain 2017-07-22 19:28:36.313 INFO 6235 --- [nio-8080-exec-1] crsJwtAuthenticationTokenFilter : checking authentication for user null 2017-07-22 19:28:36.323 DEBUG 6235 --- [nio-8080-exec-1] osswaExceptionTranslationFilter : Chain processed normally 2017-07-22 19:28:36.323 DEBUG 6235 --- [nio-8080-exec-1] sswcSecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed 

这是从Docker容器运行相同的应用程序的日志:

 2017-07-22 18:35:49.845 DEBUG 7 --- [nio-8080-exec-1] osswaiFilterSecurityInterceptor : Authorization successful 2017-07-22 18:35:49.845 DEBUG 7 --- [nio-8080-exec-1] osswaiFilterSecurityInterceptor : RunAsManager did not change Authentication object 2017-07-22 18:35:49.845 DEBUG 7 --- [nio-8080-exec-1] ossecurity.web.FilterChainProxy : /h2-console/ reached end of additional filter chain; proceeding with original chain 2017-07-22 18:35:49.847 INFO 7 --- [nio-8080-exec-1] crsJwtAuthenticationTokenFilter : checking authentication for user null 2017-07-22 18:35:49.865 WARN 7 --- [nio-8080-exec-1] osweb.servlet.PageNotFound : No mapping found for HTTP request with URI [/api/v1/h2-console/] in DispatcherServlet with name 'dispatcherServlet' 2017-07-22 18:35:49.867 DEBUG 7 --- [nio-8080-exec-1] osswaExceptionTranslationFilter : Chain processed normally 2017-07-22 18:35:49.867 DEBUG 7 --- [nio-8080-exec-1] sswcSecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed 

我的假设是,在处理来自docker容器的请求时,api正试图找到包含服务器上下文路径/ api / v1 / h2-console /而不是/ h2-console /的url的匹配。 任何想法家伙?

为了突出显示docker容器的端口8080从localhost映射到8080端口,所以api是可以访问的。

 CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES 48e1278a01f7 rafboard/backend-services "sh -c 'java $JAVA..." 31 minutes ago Up 31 minutes 0.0.0.0:8080->8080/tcp pensive_borg 

谢谢。