Example of docker-compose for keycloak 18 with ability to import a realm file:
It assumes the realm-export.json file is in /PATH_OF_realm-export.json_FILE/
docker-compose.yml:
version: '3'
services:
keycloak:
image: 'quay.io/keycloak/keycloak:18.0.2'
container_name: keycloak
command: [ 'start-dev --import-realm' ]
environment:
- KEYCLOAK_DB=dev-file
- KEYCLOAK_ADMIN=admin
- KEYCLOAK_ADMIN_PASSWORD=admin
- KEYCLOAK_FEATURES=scripts
- KEYCLOAK_HTTP_PORT=8080
volumes:
- /PATH_OF_realm-export.json_FILE/:/opt/keycloak/data/import
ports:
- 8082:8080