Johann Savalle

@yasha.solutions

Product designer and full stack developper living in france
< Back to all articles

Installing Keycloack with Docker

February 08, 2020

Installing keycloak

Keycloak is a redhat (and therefore now IBM) product for Identity and Access Management, so you can add authentication to applications and secure services. It's all available out of the box.

If you need an auth service for your app, Keycloak is a perfect candidate.

Keycloak Screenshot

Docker compose

I like docker compose, so here is how I do it using official example from their repo:

version: '3'
volumes:
  postgres_data:
      driver: local
services:
  postgres:
      image: postgres
      volumes:
        - postgres_data:/var/lib/postgresql/data
      environment:
        POSTGRES_DB: dbname
        POSTGRES_USER: dbuser
        POSTGRES_PASSWORD: dbpassword
  keycloak:
      image: jboss/keycloak
      environment:
        DB_VENDOR: POSTGRES
        DB_ADDR: postgres
        DB_DATABASE: dbname
        DB_USER: dbuser
        DB_PASSWORD: dbpassword
        KEYCLOAK_USER: admin
        KEYCLOAK_PASSWORD: adminpwd
        ports:
        - 26000:8080
      depends_on:
        - postgres

Alternative local installation

You can also run the simplest script to get it run in docker mode for local dev.

$ docker run -p 8090:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin -e DB_VENDOR=H2 jboss/keycloak

Will run you docker on 8090 with admin/admin as user password and H2 as embeded database - so no need for external SQL engine.

< Back to all articles