This project provides a Docker Compose configuration for running Keycloak locally with PostgreSQL persistence.
docker compose up -d- Keycloak 26.3: Identity and Access Management server
- PostgreSQL 17.5: Database for persistent data storage
- Persistent Volume: Preserves realms, clients, users, and configurations between restarts
- Keycloak Admin Console: http://localhost:8080
- Default Admin Credentials:
- Username:
admin - Password:
admin
- Username:
- PostgreSQL Database:
localhost:5432- Database:
keycloak - Username:
postgres - Password:
123456
- Database:
- Development mode configuration (
start-dev) - Health checks enabled on port 9000
- Metrics endpoint available
- Automatic database initialization
- Data persistence across container restarts
The setup uses environment variables for configuration. Key settings include:
- Database connection to PostgreSQL
- Admin user bootstrap
- Health and metrics endpoints
- Development mode for easier local testing
Your Keycloak data (realms, clients, users, roles, etc.) is automatically persisted in the keycloak-postgres-volume
Docker volume. This means your configuration will survive container restarts and recreations.
For detailed integration instructions and usage examples, see the comprehensive guide:
https://vulinhjava.io.vn/blog/spring-boot-3-keycloak-integration
docker compose downTo remove everything including the persistent volume:
docker compose down -v