0
votes

Currently, I am working on docker and docker-compose. I want to know that whenever I do docker-compose down and then after try to up all the service keycloak in which JSON file for the realm imported on the starter of keycloak server It started from zero as realm -> credential -> client secret key is different every time.

And one more I have to fire these two commands than only I can access http://ip:8080/auth

./kcadm.sh config credentials --server http://localhost:8080/auth --realm master --user admin --password **** ./kcadm.sh update realms/master -s sslRequired=NONE

1

1 Answers

1
votes

What database setup are you using?

If nothing is configured then Keycloak will fallback on H2 in-memory database. Unless you do some volume mapping any configuration and users will be deleted on docker-compose down.

You can also use environment variables to create a Keycloak user on startup, see Keycloak docker documentation. Example with volume mapping to persist h2 data and create user:

volumes:
  keycloak_data:

volumes:
  - keycloak_data:/opt/jboss/keycloak/standalone/data
environment:
  - KEYCLOAK_USER=test
  - KEYCLOAK_PASSWORD=test