Keycloak with sqlserver support
556
Keycloak Server Docker image.
To boot in standalone mode
docker run jboss/keycloak
To be able to open Keycloak on localhost map port 8080 locally
docker run -p 8080:8080 jboss/keycloak
By default there is no admin user created so you won't be able to login to the admin console. To create an admin account you need to use environment variables to pass in an initial username and password. This is done by running:
docker run -e KEYCLOAK_USER=<USERNAME> -e KEYCLOAK_PASSWORD=<PASSWORD> jboss/keycloak
You can also create an account on an already running container by running:
docker exec <CONTAINER> keycloak/bin/add-user-keycloak.sh -u <USERNAME> -p <PASSWORD>
Then restarting the container:
docker restart <CONTAINER>
This image supports using H2, MySQL, PostgreSQL or SQL Server as the database. The image will automatically detect what DB to use based on the following rules:
postgres hostname resolves or POSTGRES_ADDR environment variable is setmysql hostname resolves or MYSQL_ADDR environment variable is setsqlserver hostname resolves or SQLSERVER_ADDR environment variable is setDB_VENDOR environment variable not setYou can also use the DB_VENDOR environment variable to explicitly specify the database:
h2 for the embedded H2 database,postgres for the Postgres database,mysql for the MySql database,sqlserver for the SQL Server database.docker network create keycloak-network
First start a MySQL instance using the MySQL docker image:
docker run --name mysql -d --net keycloak-network -e MYSQL_DATABASE=keycloak -e MYSQL_USER=keycloak -e MYSQL_PASSWORD=password -e MYSQL_ROOT_PASSWORD=root_password mysql
If you choose a different container name to mysql you need to specify the MYSQL_ADDR environment variable.
Start a Keycloak instance and connect to the MySQL instance:
docker run --name keycloak --net keycloak-network jboss/keycloak
Specify hostname of MySQL database (optional, default is mysql).
Specify port of MySQL database (optional, default is 3306).
Specify name of MySQL database (optional, default is keycloak).
Specify user for MySQL database (optional, default is keycloak).
Specify password for MySQL database (optional, default is password).
docker network create keycloak-network
First start a PostgreSQL instance using the PostgreSQL docker image:
docker run -d --name postgres --net keycloak-network -e POSTGRES_DB=keycloak -e POSTGRES_USER=keycloak -e POSTGRES_PASSWORD=password postgres
If you choose a different container name to postgres you need to specify the POSTGRES_ADDR environment variable.
Start a Keycloak instance and connect to the PostgreSQL instance:
docker run --name keycloak --net keycloak-network jboss/keycloak
Specify hostname of PostgreSQL database (optional, default is postgres).
Specify port of PostgreSQL database (optional, default is 3306).
Specify name of PostgreSQL database (optional, default is keycloak).
Specify user for PostgreSQL database (optional, default is keycloak).
Specify password for PostgreSQL database (optional, default is password).
Specify hostname of SQL Server database (optional, default is sqlserver).
Specify port of SQL Server database (optional, default is 1433).
Specify name of SQL Server database (optional, default is keycloak).
Specify user for SQL Server database (optional, default is keycloak).
Specify password for SQL Server database (optional, default is password).
Legacy container links (--link) are still supported, but these will be removed at some point in the future.
We recommend if you are using these to change to user defined networks as shown in the previous examples.
docker run --name postgres -e POSTGRES_DB=keycloak -e POSTGRES_USER=keycloak -e POSTGRES_PASSWORD=password -d postgres
docker run --name keycloak --link postgres:postgres jboss/keycloak
To add a custom theme extend the Keycloak image and add the theme to the /opt/jboss/keycloak/themes directory.
To add a custom provider extend the Keycloak image and add your provider to the /opt/jboss/keycloak/standalone/deployments/
directory.
When starting the Keycloak instance you can pass a number an environment variables to set log level for Keycloak, for example:
docker run -e KEYCLOAK_LOGLEVEL=DEBUG jboss/keycloak
When running Keycloak behind a proxy, you will need to enable proxy address forwarding.
docker run -e PROXY_ADDRESS_FORWARDING=true jboss/keycloak
This image extends the jboss/base-jdk image which adds the OpenJDK
distribution on top of the jboss/base image. Please refer to the README.md
for selected images for more info.
Content type
Image
Digest
Size
341.8 MB
Last updated
over 8 years ago
docker pull pewpewwarrior/keycloak-sqlserver