【发布时间】:2019-07-04 01:59:14
【问题描述】:
我正在关注this tutorial,它运行良好,它是单点登录应用程序,然后我尝试为每个服务构建一个 docker 映像并公开它们正在使用的端口,但是当我登录 app1 服务时,这个响应:
Whitelabel Error Page
This application has no explicit mapping for /error, so you are seeing this as a fallback.
Sun Feb 10 11:11:54 GMT 2019
There was an unexpected error (type=Unauthorized, status=401).
Authentication Failed: Could not obtain access token
也许两个 docker 镜像没有相互通信,因为如果我在没有 docker 的情况下启动这个 spring-boot 应用程序,它们可以正常工作。
在that codes 中只有我引入了一个 mvn 插件来为每个项目(sso-server,app1,app2)构建一个 docker 镜像:
<plugin>
<groupId>com.spotify</groupId>
<artifactId>dockerfile-maven-plugin</artifactId>
<version>1.4.0</version>
<configuration>
<repository>MYREPO/project</repository>
<tag>${project.version}</tag>
<buildArgs>
<JAR_FILE>target/${project.build.finalName}.jar</JAR_FILE>
</buildArgs>
</configuration>
<executions>
<execution>
<id>default</id>
<phase>install</phase>
<goals>
<goal>build</goal>
<goal>push</goal>
</goals>
</execution>
</executions>
</plugin>
我尝试为每个图像命名(-n)并链接每个图像(--link),但它不起作用。
一些建议?
【问题讨论】:
-
你试过 docker-compose 吗?
-
你能和我们分享你的 application.yml 吗?
标签: spring spring-boot docker