Prepare Githup Login
$ export CR_PAT=ghp_q90tmqOTkNcX....
$ echo $CR_PAT | docker login ghcr.io -u USERNAME --password-stdin
Login Succeeded
Start an new docker instance and import a certain Realm
$ docker run --name keycloak -e KEYCLOAK_ADMIN=admin -e KEYCLOAK_ADMIN_PASSWORD=admin -p 8280:8080 -p 8543:8443 \
-v "D:/dev/Quarkus/Keycloak/quarkus-keycloak-authorization-sample/import:/opt/keycloak/data/import" \
quay.io/keycloak/keycloak:18.0.0 start-dev --import-realm --http-relative-path=auth
-> At this stage you may run add. chnages to your Realm
Vaildate running docker image
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESe
87149ce46008 quay.io/keycloak/keycloak:18.0.0 "/opt/keycloak/bin/k…" 2 days ago Up 2 days 0.0.0.0:8280->8080/tcp, 0.0.0.0:8543->8443/tcp keycloak
Commit container’s file changes or settings into a new image
$ docker commit 87149ce46008
sha256:6479e087e23f0650c3ca366f0d1f2d843379c37d32ce44cb7209b4c73813fffb
Vaildate running docker image again
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ghcr.io/hhutzler/keycloak-oidc 18.0.0 6479e087e23f About a minute ago 726MB
quay.io/keycloak/keycloak 18.0.0 268d8705bd41 3 months ago 552MB
Finally push the image to our Githup Repository
$ docker push ghcr.io/hhutzler/keycloak-oidc:18.0.0
The push refers to repository [ghcr.io/hhutzler/keycloak-oidc]
250a49465e8f: Pushed
b0a3e9723423: Mounted from hhutzler/keycloak
5c0f901ed515: Mounted from hhutzler/keycloak
e34e3bdec276: Mounted from hhutzler/keycloak
dff9f8de74c0: Mounted from hhutzler/keycloak
18.0.0: digest: sha256:cb689b894b4b7ef50de587675a84a06cfa257c3362be0d735b778750a92d7cfe size: 1375
Pull a custom keycloak image from Github
Pull image from github
$ docker pull ghcr.io/hhutzler/keycloak-oidc:18.0.0
18.0.0: Pulling from hhutzler/keycloak-oidc
4752687a61a9: Pull complete
0344366a246a: Pull complete
bf8a68204bbb: Pull complete
c4db0a36467a: Pull complete
cee1cf7e6df1: Pull complete
Digest: sha256:cb689b894b4b7ef50de587675a84a06cfa257c3362be0d735b778750a92d7cfe
Status: Downloaded newer image for ghcr.io/hhutzler/keycloak-oidc:18.0.0
ghcr.io/hhutzler/keycloak-oidc:18.0.0
Validate images
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ghcr.io/hhutzler/keycloak-oidc 18.0.0 6479e087e23f 23 minutes ago 726MB
Run a new container
$ docker run -p 8280:8080 -p 8543:8443 6479e087e23f
2022-08-23 15:28:00,493 INFO [org.keycloak.quarkus.runtime.hostname.DefaultHostnameProvider] (main) Hostname settings: FrontEnd: <request>, Strict HTTPS: false, Path: <request>, Strict BackChannel: false, Admin: <request>, Port: -1, Proxied: false
2022-08-23 15:28:01,177 WARN [org.infinispan.PERSISTENCE] (keycloak-cache-init) ISPN000554: jboss-marshalling is deprecated and planned for removal
2022-08-23 15:28:01,201 WARN [org.infinispan.CONFIG] (keycloak-cache-init) ISPN000569: Unable to persist Infinispan internal caches as no global state enabled
2022-08-23 15:28:01,228 INFO [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000556: Starting user marshaller 'org.infinispan.jboss.marshalling.core.JBossUserMarshaller'
2022-08-23 15:28:01,424 INFO [org.infinispan.CONTAINER] (keycloak-cache-init) ISPN000128: Infinispan version: Infinispan 'Triskaidekaphobia' 13.0.8.Final
2022-08-23 15:28:04,952 INFO [org.keycloak.connections.infinispan.DefaultInfinispanConnectionProviderFactory] (main) Node name: node_887166, Site name: null
2022-08-23 15:28:05,489 ERROR [org.keycloak.services] (main) KC-SERVICES0010: Failed to add user 'admin' to realm 'master': user with username exists
2022-08-23 15:28:05,621 INFO [io.quarkus] (main) Keycloak 18.0.0 on JVM (powered by Quarkus 2.7.5.Final) started in 8.355s. Listening on: http://0.0.0.0:8080
2022-08-23 15:28:05,622 INFO [io.quarkus] (main) Profile dev activated.
2022-08-23 15:28:05,622 INFO [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-h2, jdbc-mariadb, jdbc-mssql, jdbc-mysql, jdbc-oracle, jdbc-postgresql, keycloak, narayana-jta, reactive-routes, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-health, smallrye-metrics, vault, vertx]
2022-08-23 15:28:05,628 WARN [org.keycloak.quarkus.runtime.KeycloakMain] (main) Running the server in development mode. DO NOT use this configuration in production.
Be First to Comment