I am trying to run the keycloak on docker container. I tried running it in two different approaches:
First solution:
I come up with the below command from this link:
docker run --name mykeycloak -p 8080:8080 -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin quay.io/keycloak/keycloak:latest start-dev
Second solution that i tried to run it via a Dockerfile which basically does the same thing:
# Use Keycloak's latest image as the base
FROM quay.io/keycloak/keycloak:23.0
# Set environment variables for admin user
ENV KEYCLOAK_ADMIN=admin \
KEYCLOAK_ADMIN_PASSWORD=admin \
KEYCLOAK_PROFILE_FEATURE_UPLOAD_SCRIPTS=enabled
# Set the command to start Keycloak in dev mode and import the realm
CMD ["start-dev", "--import-realm"]
it is quit easy to build an image and run the built image on port 8080
.
In both of the solution, i can run the keycloak successfully and here is the logs in console:
[io.quarkus.deployment.QuarkusAugmentor] (main) Quarkus augmentation completed in 5414ms
2023-12-29 09:42:47,335 INFO [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: Base URL: <unset>, Hostname: <request>, Strict HTTPS: false, Path: <request>, Strict BackChannel: false, Admin URL: <unset>, Admin: <request>, Port: -1, Proxied: false
2023-12-29 09:42:48,520 WARN [io.quarkus.agroal.runtime.DataSources] (main) Datasource <default> enables XA but transaction recovery is not enabled. Please enable transaction recovery by setting quarkus.transaction-manager.enable-recovery=true, otherwise data may be lost if the application is terminated abruptly
2023-12-29 09:42:48,839 WARN [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2023-12-29 09:42:48,917 WARN [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
2023-12-29 09:42:49,004 INFO [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
2023-12-29 09:42:51,146 INFO [org.keycloak.quarkus.runtime.storage.legacy.liquibase.QuarkusJpaUpdaterProvider] (main) Initializing database schema. Using changelog META-INF/jpa-changelog-master.xml
UPDATE SUMMARY
Run: 117
Previously run: 0
Filtered out: 0
-------------------------------
Total change sets: 117
2023-12-29 09:42:53,681 INFO [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: node_597367, Site name: null
2023-12-29 09:42:53,747 INFO [org.keycloak.broker.provider.AbstractIdentityProviderMapper] (main) Registering class org.keycloak.broker.provider.mappersync.ConfigSyncEventListener
2023-12-29 09:42:53,774 INFO [org.keycloak.services] (main) KC-SERVICES0050: Initializing master realm
2023-12-29 09:42:55,037 INFO [io.quarkus] (main) Keycloak 23.0.3 on JVM (powered by Quarkus 3.2.9.Final) started in 8.538s. Listening on: http://0.0.0.0:8080
2023-12-29 09:42:55,038 INFO [io.quarkus] (main) Profile dev activated.
2023-12-29 09:42:55,038 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-h2, jdbc-mariadb, jdbc-mssql, jdbc-mysql, jdbc-oracle, jdbc-postgresql, keycloak, logging-gelf, micrometer, narayana-jta, reactive-routes, resteasy-reactive, resteasy-reactive-jackson, smallrye-context-propagation, smallrye-health, vertx]
2023-12-29 09:42:55,291 INFO [org.keycloak.services] (main) KC-SERVICES0009: Added user 'admin' to realm 'master'
2023-12-29 09:42:55,296 WARN [org.keycloak.quarkus.runtime.KeycloakMain] (main) Running the server in development mode. DO NOT use this configuration in production.
However, when i try to access the keyclaok on http://localhost:8080/auth/ the console is not available:
I have already seen this question, but it did not help me.
With this version of keycloak which is 23.0
, you should access the keycloak using http://localhost:8081/
so, you must remove the word auth
at the end of path.
Also, please try to disable the firewalls just to see if they are blocking any requests