Docker Community Forums

Share and learn in the Docker community.

Can't use Keycloak with docker compose


(Laurentiutanase) #1

Hello!

I am sort of new to docker, i used it for almost 1 month and I have one issue:

Today i made a Docker-compose file with a front end service for my app and i tried to add keycloak to that front end. The issue is that i have the keycloak container service name “Keycloak” and when i check from my-app config that the keycloak container is okay ( http:/keycloak:< port number >/ or https://< ip of the keycloak container >: / ).

When i tried to access the http port of my app ( https:/localhost:< my-app port number > ) to redirect me to my login page i get redirected to https:/keycloak:< port number > instead of https:/localhost:< keycloak port number >.

My question is: is there any way that i can map the keycloak port or get the container IP address when i run docker-compose up from my docker file?

I found an work-around that allows me to access https:/keycloak:< port number > by modifying my /etc/hosts file, but it is not an very nice way to do that. Thanks in advance for any tips that can help me solve my problem.