docker-compose


network issue in one docker compose with keycloak and tomcat container


Greeting,
I'm a beginner is learning web authentication, and would like to try with tomcat and keycloak in docker compose. I put them in one docker-compose.yml as follows:
version: '2'
services:
postgres:
image: postgres
ports:
- "5432:5432"
environment:
POSTGRES_DATABASE: 'keycloak'
POSTGRES_USER: 'keycloak'
POSTGRES_PASSWORD: 'keycloak'
POSTGRES_ROOT_PASSWORD: 'test'
volumes:
- ./postgres:/mnt/shares/postgres
keycloak:
image: jboss/keycloak-postgres
ports:
- "800:8080"
links:
- postgres
environment:
POSTGRES_PORT_5432_TCP_ADDR: 'postgres'
POSTGRES_DATABASE: 'keycloak'
POSTGRES_USER: 'keycloak'
POSTGRES_PASSWORD: 'keycloak'
KEYCLOAK_USER: 'admin'
KEYCLOAK_PASSWORD: 'admin'
POSTGRES_ROOT_PASSWORD: 'test'
depends_on:
- postgres
volumes:
- ./keycloak:/mnt/shares/keycloak
tomcat_keycloak:
build: .
ports:
- "880:8080"
volumes:
- ./web:/mnt/shares/web
- ./scratches:/mnt/shares/scratches
This can launch fine. Next I created the realm, client, and user in the keycloak, obtained a keycloak.json for tomcat as follows:
{
"realm": "TestRealm",
"auth-server-url": "http://192.168.208.130:800/auth",
"ssl-required": "external",
"resource": "test-client",
"public-client": true,
"use-resource-role-mappings": true
}
where 192.168.208.130 is my host ip address. Then I tried a static web link in my tomcat server. I could be redirected to the keycloak login page. But after entering user name and password, I got HTTP status 403. In the keycloak events I saw the logon was successful, and a session was established. I checked the tomcat output, and then found the following:
07-Apr-2017 17:37:04.240 INFO [http-apr-8080-exec-4] org.apache.http.impl.client.DefaultHttpClient.tryConnect I/O exception (java.net.NoRouteToHostException) caught when connecting to {}->http://192.168.208.130:800: No route to host (Host unreachable)
Looks like from my tomcat container, I cannot do HTTP client connection to my keycloak server container via the URL in host ip address. I can ping the host ip from the tomcat container though.
Could you help me to find out what I'm missing in this configuration? Really appreciate.

Related Links

docker-compose Windows volume
Trying to figure out why eslint-watch doesn't work with docker-compose correctly
docker-compose the latest stable version on ubuntu
docker compose environment variable for command
java.net.UnknownHostException: failed to resolve 'inventory-microservice'. Exceeded max queries per resolve 3
What does working_dir tag mean in a docker-compose yml file
If I upgrade an image in docker-compose, will its volumes be lost?
How to solve this docker-compose upgrading error?
Fabric Network - what happens when a downed peer connects back to the network?
Docker-compose and load balancing
Run arguments in Docker Compose
Docker compose file config
Systemd “No such file or directory” itself during “docker-compose up”
Docker compose yml static IP addressing
compose extend file results in a validation error
hubot rocketchat adapter does not work

Categories

HOME
asp.net
max
gcc
intellisense
apache-storm
livecharts
arguments
salesforce-lightning
opc-ua
xss
grid
autocad
country-codes
cdn
markdown
ios-universal-links
google-my-business-api
hdf5
opengrok
amazon-data-pipeline
powerpivot
django-rest-auth
gpo
hl7-fhir
datasource
vala
hololens
screen-scraping
deployment-descriptor
traveling-salesman
formtastic
typeorm
mobile-development
login-required
powerbi-embedded
android-databinding
kdevelop
client-server
pygraphviz
nscollectionview
idea-plugin
keychain
irr
geminabox
import.io
runtime-permissions
openpgp.js
android-vectordrawable
copy-constructor
portaudio
distcc
require-handlebars
angular-i18n
archiva
radar-chart
abstract
oryx
encode
gnu-sort
javapackager
notice
page-flipping
pushwoosh
borland-c++
pagecontrol
transparentproxy
stderr
beagleboard
dojox.grid
formbuilder
tigase
enquire.js
cvi
.net-reflector
autofilter
wpd
azure-scheduler
exi
cocotron
cloudmade
simplemembership
blotter
freeimage
hypertable
ios6-maps
bash4
reflexil
automapper-2
httppostedfilebase
service-layer
auto-compile
cinder
atmega16
unauthorized

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App