# KeyCloak 19.0.1: KC\_\* Environment variables are ignored

**URL:** https://forum.keycloak.org/t/keycloak-19-0-1-kc-environment-variables-are-ignored/17157
**Category:** Configuring the server
**Created:** [August 30, 2022, 1:53pm UTC](https://forum.keycloak.org/t/keycloak-19-0-1-kc-environment-variables-are-ignored/17157 "2022-08-30T13:53:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![mtschemernjak](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mtschemernjak](https://forum.keycloak.org/u/mtschemernjak)
#### Post date: [August 30, 2022, 1:53pm UTC](https://forum.keycloak.org/t/keycloak-19-0-1-kc-environment-variables-are-ignored/17157/1 "2022-08-30T13:53:41Z")

</div>

Hi,  
I use the following dockerImage to create an image for keycloak that is then deployed to k8s:

```auto
FROM quay.io/keycloak/keycloak:19.0.1 as builder

ENV KC_HEALTH_ENABLED=true
ENV KC_METRICS_ENABLED=true
ENV KC_FEATURES=token-exchange
ENV KC_DB=postgres

COPY keycloak-templates /opt/jboss/keycloak/themes/conpal
COPY plugins/* /opt/jboss/keycloak/standalone/deployments/

RUN /opt/keycloak/bin/kc.sh build

FROM quay.io/keycloak/keycloak:19.0.1

COPY --from=builder /opt/keycloak/ /opt/keycloak/

ENTRYPOINT ["/opt/keycloak/bin/kc.sh", "start", "--optimized"]

```

In the K8s Deployment I set additional Environment vars.

- KC\_DB
- KC\_DB\_URL\_DATABASE
- KC\_DB\_SCHEMA
- KC\_DB\_PASSWORD
- KC\_DB\_USERNAME
- KC\_DB\_URL\_HOST
- KEYCLOAK\_ADMIN
- KEYCLOAK\_ADMIN\_PASSWORD

Non of the above variables are considered…  
The admin user is not created, the health endpoints are not there. On Startup I see that keycloak uses H2 as database and not postgresql.

If I use the old Env Vars like DB\_VENDOR, it works.  
This might help me with the database and admin user but I have now issues with KC\_HOSTNAME and KC\_HOSTNAME\_ADMIN

also I do not want to use the old environment vars…

Currently I have no idea what the issue is, would be happy for any adive.

thank you!

---

<div class="post-metadata">

### Author: ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)
#### Post date: [August 30, 2022, 2:50pm UTC](https://forum.keycloak.org/t/keycloak-19-0-1-kc-environment-variables-are-ignored/17157/2 "2022-08-30T14:50:14Z")

</div>

Check the guide here:

> **[All configuration - Keycloak](https://www.keycloak.org/server/all-config)**
>
> Keycloak is an open source identity and access management solution

If there is a little tool icon in the right column of the table, that is a property that must be set in the Dockerfile before running `build`. As you have observed, there are some legacy vars that can cause unexpected (or, in your case, expected) behavior, but the guide in the link is how things are supposed to work in the future.

---

<div class="post-metadata">

### Author: ![mtschemernjak](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@mtschemernjak](https://forum.keycloak.org/u/mtschemernjak)
#### Post date: [August 30, 2022, 3:58pm UTC](https://forum.keycloak.org/t/keycloak-19-0-1-kc-environment-variables-are-ignored/17157/3 "2022-08-30T15:58:23Z")

</div>

OK, thanks.  
Maybe I have overseen something, I will check it out

---

<div class="post-metadata">

### Author: ![zak](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/zak/32/315_2.png) [@zak](https://forum.keycloak.org/u/zak)
#### Post date: [September 6, 2022, 9:41am UTC](https://forum.keycloak.org/t/keycloak-19-0-1-kc-environment-variables-are-ignored/17157/4 "2022-09-06T09:41:28Z")

</div>

I am having the same issue, were you able to resolve the problem ?

@xgp

> If there is a little tool icon in the right column of the table, that is a property that must be set in the Dockerfile before running `build`

Keycloak now builds on every start, unless you specify the `--optimized` flag

---

<div class="post-metadata">

### Author: ![xgp](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/xgp/32/2589_2.png) [@xgp](https://forum.keycloak.org/u/xgp)
#### Post date: [September 6, 2022, 11:55am UTC](https://forum.keycloak.org/t/keycloak-19-0-1-kc-environment-variables-are-ignored/17157/5 "2022-09-06T11:55:15Z")

</div>

That sounds right. I’m not really sure how it’s supposed to work, but setting a variable that is supposed to be a “build” variable will force a build on every start unless `--optimized` is set.
