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: doesnt allow to use constraints if you have a env variable set
How to use visual studio docker function on Windows Home edition?
Passing arguments to docker compose file when using it for swarm
How to run ad hoc docker compose commands in Ansible?
Using custom hostnames for docker local development containers
Changing the network name?
Let external container know about subnets created by multiple docker-compose projects
How to monitor / discover more docker containers with prometheus
two docker-compose .yml in the same network with COMPOSE_PROJECT_NAME
docker compose 3.1(swarm), secrets, ssl and nginx
What is the version directive for?
How to run docker-compose up -d at system start up?
In Docker Compose can I have services exiting
Docker compose - secrets Additional property secrets is not allowed
docker-compose mounted volume remain
Should I do anything after upgrading docker-compose?

Categories

HOME
azure-active-directory
qemu
customization
process
grpc
where
overrides
mingw
glympse
open-search-server
virtualhost
segmentation-fault
vichuploaderbundle
decoding
mbed
aggregate
template10
jquery-easyui
autologin
openoffice-basic
descriptor
rndis
pumping-lemma
ithit-webdav-server
aws-certificate-manager
sqldependency
request-uri
jms-topic
cqlsh
opencsv
login-required
jcr
incapsula
dom4j
flex3
rtsp
framebuffer
queryover
instances
scalamock
jquery-inputmask
datagridviewcombobox
python-venv
inner-join
taleo
amazon-fire-tv
django-cors-headers
togglebutton
anonymous-function
import.io
history
cc
nsalert
multi-select
group
konakart
mate-desktop
nimbus
mrunit
abstract
dynamics-nav
skscene
mojolicious
database-project
adempiere
sparkcore
dcg
douglas-peucker
pysvn
system.io.packaging
os.walk
nsmutableurlrequest
sat4j
cs193p
power-management
git-subtree
mixradio
db2-connect
caroufredsel
oc4j
uikit-dynamics
exi
ncml
derived-class
xcode4.6.3
django-1.4
mvcmailer
ruby-1.9
capitalization
automapper-2
zend-validate
xpolog
jquery-click-event
symfony-1.2
youtube.net-api
lightopenid
netduino
cryptolicensing
noise-reduction
simultaneous
helios
dgml
data-formats

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