I needed to do this was trying with docker compose but was not able to find any proper documentation to help.
Hi there,
this Documentation should be helpful especially for docker https://www.keycloak.org/server/containers
To get started, I’ll give you my script for a small local test environment including postgress connectivity.
docker-compose.yml
# docker version
version: "3"
services:
Backend_Frontend:
image: quay.io/keycloak/keycloak:20.0.0
command: start-dev
environment:
KC_DB: postgres
KC_DB_URL_HOST: postgres_svr
KC_DB_URL_DATABASE: db_name
KC_DB_PASSWORD: password
KC_DB_USERNAME: user_name
KC_DB_SCHEMA: public
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: admin
ports:
- "8080:8080"
depends_on:
postgres_svr:
condition: service_healthy
networks:
network_sso:
ipv4_address: "10.0.0.2"
postgres_svr:
image: postgres:10
command: postgres -c 'max_connections=200' && postgres -c 'shared_buffers=24MB'
environment:
# Environment Variables expecially for Postgres
POSTGRES_DB: db_name
POSTGRES_USER: user_name
POSTGRES_PASSWORD: password
healthcheck:
test: "exit 0"
ports:
- "5432:5432"
networks:
network_sso:
ipv4_address: "10.0.0.3"
networks:
network_sso:
ipam:
# IP Address management
driver: default
# default = bridge
config:
- subnet: "10.0.0.0/24"
Open your Browser and check this url “http://localhost:8080/”