I tried that by specifying a different URL for the OAuth2 issuer.
version: '2'
services:
blog-app:
image: blog
environment:
- SPRING_PROFILES_ACTIVE=prod,swagger
- JHIPSTER_SLEEP=10 # gives time for the database to boot before the application
ports:
- 8080:8080
blog-postgresql:
extends:
file: postgresql.yml
service: blog-postgresql
keycloak:
extends:
file: keycloak.yml
service: keycloak
To make this work so I can see the initial login screen, I had to add an entry in /etc/hosts, which isn’t a great developer experience.
127.0.0.1 keycloak
And the error is still the same from Spring Security:
blog-app_1 | at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:666)
blog-app_1 | at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:621)
blog-app_1 | at org.springframework.security.oauth2.client.token.OAuth2AccessTokenSupport.retrieveToken(OAuth2AccessTokenSupport.java:137)
blog-app_1 | ... 75 common frames omitted
blog-app_1 | Caused by: java.net.ConnectException: Connection refused (Connection refused)
blog-app_1 | at java.net.PlainSocketImpl.socketConnect(Native Method)