How can I enable the user profile feature on a docker instance of keycloak? Where do i add the flag " --features=declarative-user-profile
"?
Well you could mount a config file into the container:
services:
keycloak:
image: quay.io/keycloak/keycloak:19.0.1
volumes:
- ./keycloak.conf:/opt/keycloak/conf/keycloak.conf
in a config file you don’t need --
in the flags.
Or you specify the whole command with all the options in the command
section of the docker-compose.yml
file.
Could you please explain this more? I am new to docker so I’m not sure how to implement it the way you described.
Don’t know the answer to this?
@belfhi is showing you a docker compose file. If you are new to docker, look up docker-compose
documentation for how to use these.
@Terak-10 per your original question, you can use docker-compose
to add the KC_FEATURES
variable to your environment. Here is an example of a docker-compose configuration file that will run keycloak with a postgres database and caddy reverse proxy.
version: '3'
volumes:
postgres_data:
driver: local
caddy_data:
driver: local
services:
postgres:
image: postgres:11
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: keycloak
POSTGRES_USER: keycloak
POSTGRES_PASSWORD: password
ports:
- 5433:5432
keycloak:
image: http://quay.io/keycloak/keycloak:19.0.1
environment:
KEYCLOAK_ADMIN: admin
KEYCLOAK_ADMIN_PASSWORD: password
KC_DB: postgres
KC_DB_URL_HOST: postgres
KC_DB_URL_DATABASE: keycloak
KC_DB_SCHEMA: public
KC_DB_USERNAME: keycloak
KC_DB_PASSWORD: password
KC_HOSTNAME_STRICT: 'false'
KC_HTTP_ENABLED: 'true'
KC_PROXY: 'edge'
KC_FEATURES: 'declarative-user-profile'
ports:
- 8080:8080
- 8443:8443
depends_on:
- postgres
caddy:
image: caddy:2.4.6-alpine
restart: unless-stopped
command: caddy reverse-proxy --from https://localhost:443 --to http://keycloak:8080
ports:
- 80:80
- 443:443
volumes:
- caddy_data:/data
depends_on:
- keycloak
yes, this is what I meant. I’m sorry, I didn’t realize you were that new to docker and docker-compose. The above example should work!