I installed keycloak using docker for my django project
docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin jboss/keycloak
now everything is working fine but now i want take backup of keycloak db in docker but i do not know which database installed by default inside keycloak docker container,so how to take backup and restore data,
i was using $ sudo docker exec -it 35ba690a68fd /bin/bash this command to interact with container, please any suggestion. i am using redhat Linux
By default, Keycloak is using its embedded H2 database. I suggest that you move to an external DB so that you will be able to managed backup more simply.
see https://www.keycloak.org/docs/latest/server_installation/index.html#_database and https://github.com/keycloak/keycloak-containers/tree/master/server#database regarding the supported DB and how to setup env variables to connect to the DB from the Keycloak container.
Regards,
the default database is located in /opt/jboss/keycloak/standalone/data/ the name is keycloak.mv.db
if you want to back it up, I suggest mapping a volume when running keycloak:
docker run --volume /root/keycloak/data/:/opt/jboss/keycloak/standalone/data/ ...
this way the database will stay on the host and will keep the changes even if you destroy the container and recreate it.