我正在尝试这样做,但无法找到任何适当的文档来帮助我,这是我在我的docker-compose文件quayo/keycloak/keycloak:21.0.2.
这是一个示例docker-compose。我确认keycloak看起来工作得很好。
version: '3.8'
services:
postgres:
image: postgres:13.2
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: password
volumes:
- postgres_data:/var/lib/postgresql/data
keycloak:
image: quay.io/keycloak/keycloak:21.0.2
command: start-dev
environment:
DB_VENDOR: POSTGRES
DB_ADDR: postgres
DB_DATABASE: keycloak
DB_USER: keycloak
DB_PASSWORD: password
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
ports:
- 8080:8080
depends_on:
- postgres
volumes:
postgres_data:
您也可以使用bitnami/keycloak docker image。在我的docker-compose.yml
下面:
version: '3'
services:
postgresql:
image: docker.io/bitnami/postgresql:11
environment:
# ALLOW_EMPTY_PASSWORD is recommended only for development.
- ALLOW_EMPTY_PASSWORD=yes
- POSTGRESQL_USERNAME=bn_keycloak
- POSTGRESQL_DATABASE=bitnami_keycloak
volumes:
- 'postgresql_data:/bitnami/postgresql'
keycloak:
image: docker.io/bitnami/keycloak:21
restart: always
environment:
KEYCLOAK_DATABASE_VENDOR: postgresql
KEYCLOAK_CREATE_ADMIN_USER: true
KEYCLOAK_ADMIN_USER: admin
KEYCLOAK_ADMIN_PASSWORD: admin
KEYCLOAK_MANAGEMENT_USER: manager
KEYCLOAK_MANAGEMENT_PASSWORD: manager
ports:
- 8080:8080
depends_on:
- postgresql
volumes:
postgresql_data:
driver: local