# Kafka controller failed start while using properties file via docker volume

**URL:** https://forum.confluent.io/t/kafka-controller-failed-start-while-using-properties-file-via-docker-volume/8972
**Category:** Containers
**Created:** [1 November 2023 15:43 UTC](https://forum.confluent.io/t/kafka-controller-failed-start-while-using-properties-file-via-docker-volume/8972 "2023-11-01T15:43:02Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Udayendu](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/udayendu/32/3314_2.png) [@Udayendu](https://forum.confluent.io/u/Udayendu)
#### Post date: [1 November 2023 15:43 UTC](https://forum.confluent.io/t/kafka-controller-failed-start-while-using-properties-file-via-docker-volume/8972/1 "2023-11-01T15:43:02Z")

</div>

I am trying to start a controller using docker and passing all the configs via the controller properties file except the cluster\_id. But its not responding to the properties file. I am using the following command to run:

```auto
$ docker run -d --name=kafka-controller-1 -h kafka-controller-1 -v /root/controller/controller.properties:/etc/kafka/kraft/controller.properties -e CLUSTER_ID='xxxxxxxxxxxxx' confluentinc/cp-kafka:7.5.1

```

It failed to start because it failed to read the parameters as defined in the properties file and generating the below error:

```auto
# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
ef1d6ca7e3fa confluentinc/cp-kafka:7.5.1 "/etc/confluent/dock…" 3 seconds ago Exited (1) 2 seconds ago kafka-controller-1

# docker logs kafka-controller-1
===> User
uid=1000(appuser) gid=1000(appuser) groups=1000(appuser)
===> Configuring ...
Running in Zookeeper mode...
KAFKA_ZOOKEEPER_CONNECT is required.
Command [/usr/local/bin/dub ensure KAFKA_ZOOKEEPER_CONNECT] FAILED !

```

But when passing the same parameters via environmental variable, `docker run` is working fine. So is passing the properties file a standard supported approach or am I doing something incorrectly ?

I am following the steps as mentioned [Configure and Monitor KRaft | Confluent Documentation](https://docs.confluent.io/platform/current/kafka-metadata/config-kraft.html#configuration-options) for the properties file based deployment.

---

<div class="post-metadata">

### Author: ![dtroiano](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/dtroiano/32/1961_2.png) [@dtroiano](https://forum.confluent.io/u/dtroiano)
#### Post date: [1 November 2023 18:49 UTC](https://forum.confluent.io/t/kafka-controller-failed-start-while-using-properties-file-via-docker-volume/8972/2 "2023-11-01T18:49:08Z")

</div>

Hi @Udayendu,

Passing the properties file like this isn’t a supported approach. The `cp-kafka` Docker image requires environment variables for configuration and, during startup, generates the properties file.

For reference, [this](https://github.com/confluentinc/kafka-images/blob/6b2839d18052497109f834d064a410aea8c51d75/kafka/Dockerfile.ubi8) is the relevant `Dockerfile` and [this](https://github.com/confluentinc/kafka-images/blob/6b2839d18052497109f834d064a410aea8c51d75/kafka/include/etc/confluent/docker/run) is the script that runs at container startup. [Here](https://github.com/confluentinc/kafka-images/blob/6b2839d18052497109f834d064a410aea8c51d75/kafka/include/etc/confluent/docker/configure#L143) is where the environment variable-seeded properties file is used to generate the Kafka config [passed to](https://github.com/confluentinc/kafka-images/blob/6b2839d18052497109f834d064a410aea8c51d75/kafka/include/etc/confluent/docker/launch#L37) `kafka-server-start`. In your case, the properties file you mapped was ignored and it ran with the default configuration which runs in ZooKeeper mode and requires `KAFKA_ZOOKEEPER_CONNECT`.

HTH,  
Dave

---

<div class="post-metadata">

### Author: ![Udayendu](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/udayendu/32/3314_2.png) [@Udayendu](https://forum.confluent.io/u/Udayendu)
#### Post date: [2 November 2023 02:29 UTC](https://forum.confluent.io/t/kafka-controller-failed-start-while-using-properties-file-via-docker-volume/8972/3 "2023-11-02T02:29:13Z")

</div>

Thanks Dave.

Could you please let me know how the use of properties file if I want to use the Kafka in the docker mode ?

---

<div class="post-metadata">

### Author: ![dtroiano](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/dtroiano/32/1961_2.png) [@dtroiano](https://forum.confluent.io/u/dtroiano)
#### Post date: [2 November 2023 14:52 UTC](https://forum.confluent.io/t/kafka-controller-failed-start-while-using-properties-file-via-docker-volume/8972/4 "2023-11-02T14:52:01Z")

</div>

Hi @Udayendu,

Since it’s not a supported approach, you’d need to implement it. E.g., follow the pattern [here](https://docs.confluent.io/platform/current/installation/docker/development.html#change-configuration-management) but for the set of `configure`, `ensure`, and `launch` scripts.

An alternative would be to parse the properties file and export corresponding environment variables so that you don’t have to rewrite those scripts. For example, write a `props_to_env` helper that does the inverse of [this](https://github.com/confluentinc/confluent-docker-utils/blob/e2d3e2312ab432c7efcfc458b375e5103d55e847/confluent/docker_utils/dub.py#L50) and edit `/etc/confluent/docker/run` to run it using the pattern referenced above.

HTH,  
Dave
