# Kafka docker compose stopped working

**URL:** <https://forum.confluent.io/t/kafka-docker-compose-stopped-working/37281>\
**Category:** Containers\
**Created:** [18 February 2025 10:50 UTC](https://forum.confluent.io/t/kafka-docker-compose-stopped-working/37281 "2025-02-18T10:50:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jedrekd](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/jedrekd/32/1093_2.png) [@jedrekd](https://forum.confluent.io/u/jedrekd)\
**Post date:** [18 February 2025 10:50 UTC](https://forum.confluent.io/t/kafka-docker-compose-stopped-working/37281/1 "2025-02-18T10:50:00Z")

</div>

Hello,  
Up until today I’ve been using the official kafka docker compose which I took from GitHub but today out of the blue it stopped working. Right after two seconds the zookeeper goes down and after a minute all other services go down to. It used to work all just fine. I didn’t change anything with it so I don’t know why it’s not working anymore. I’m including the error message below.  
Here’s the docker compose file

```auto
---
version: '2'
services:
  zookeeper:
    image: confluentinc/cp-zookeeper:7.3.0
    hostname: zookeeper
    container_name: zookeeper
    ports:
      - "2181:2181"
    environment:
      ZOOKEEPER_CLIENT_PORT: 2181
      ZOOKEEPER_TICK_TIME: 2000

  broker:
    image: confluentinc/cp-server:7.3.0
    hostname: broker
    container_name: broker
    depends_on:
      - zookeeper
    ports:
      - "9092:9092"
      - "9101:9101"
      - "29092:29092"
    environment:
      KAFKA_BROKER_ID: 1
      KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
      KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
      KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://broker:29092,PLAINTEXT_HOST://localhost:9092
      KAFKA_METRIC_REPORTERS: io.confluent.metrics.reporter.ConfluentMetricsReporter
      KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_GROUP_INITIAL_REBALANCE_DELAY_MS: 0
      KAFKA_CONFLUENT_LICENSE_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_CONFLUENT_BALANCER_TOPIC_REPLICATION_FACTOR: 1
      KAFKA_TRANSACTION_STATE_LOG_MIN_ISR: 1
      KAFKA_TRANSACTION_STATE_LOG_REPLICATION_FACTOR: 1
      KAFKA_JMX_PORT: 9101
      KAFKA_JMX_HOSTNAME: localhost
      KAFKA_CONFLUENT_SCHEMA_REGISTRY_URL: http://schema-registry:8081
      CONFLUENT_METRICS_REPORTER_BOOTSTRAP_SERVERS: broker:29092
      CONFLUENT_METRICS_REPORTER_TOPIC_REPLICAS: 1
      CONFLUENT_METRICS_ENABLE: 'true'
      CONFLUENT_SUPPORT_CUSTOMER_ID: 'anonymous'

  schema-registry:
    image: confluentinc/cp-schema-registry:7.3.0
    hostname: schema-registry
    container_name: schema-registry
    depends_on:
      - broker
    ports:
      - "8081:8081"
    environment:
      SCHEMA_REGISTRY_HOST_NAME: schema-registry
      SCHEMA_REGISTRY_KAFKASTORE_BOOTSTRAP_SERVERS: 'broker:29092'
      SCHEMA_REGISTRY_LISTENERS: http://0.0.0.0:8081

  rest-proxy:
    image: confluentinc/cp-kafka-rest:7.3.0
    depends_on:
      - broker
      - schema-registry
    ports:
      - 8082:8082
    hostname: rest-proxy
    container_name: rest-proxy
    environment:
      KAFKA_REST_HOST_NAME: rest-proxy
      KAFKA_REST_BOOTSTRAP_SERVERS: 'broker:29092'
      KAFKA_REST_LISTENERS: "http://0.0.0.0:8082"
      KAFKA_REST_SCHEMA_REGISTRY_URL: 'http://schema-registry:8081'

  kafka-ui:
    container_name: kafka-ui
    image: provectuslabs/kafka-ui:latest
    ports:
      - 28080:8080
    environment:
      - DYNAMIC_CONFIG_ENABLED=true
    tty: true
    stdin_open: true

```

Error message in Zookeeper logs:

```auto
===> Configuring ...
2025-02-18 11:43:16 ===> Running preflight checks ... 
2025-02-18 11:43:16 ===> Check if /var/lib/zookeeper/data is writable ...
2025-02-18 11:43:16 ===> Check if /var/lib/zookeeper/log is writable ...
2025-02-18 11:43:16 ===> Launching ... 
2025-02-18 11:43:16 ===> Launching zookeeper ... 
2025-02-18 11:38:31 at java.base/java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1693)
2025-02-18 11:38:31 at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
2025-02-18 11:38:31 at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
2025-02-18 11:38:31 at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
2025-02-18 11:38:31 at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
2025-02-18 11:38:31 at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
2025-02-18 11:38:31 at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
2025-02-18 11:38:31 at java.management/java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:488)
2025-02-18 11:38:31 at jdk.management.agent/sun.management.jmxremote.ConnectorBootstrap.startLocalConnectorServer(ConnectorBootstrap.java:542)
2025-02-18 11:38:31 at jdk.management.agent/jdk.internal.agent.Agent.startLocalManagementAgent(Agent.java:318)
2025-02-18 11:38:31 at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:450)
2025-02-18 11:38:31 at jdk.management.agent/jdk.internal.agent.Agent.startAgent(Agent.java:599)
2025-02-18 11:38:31 Exception thrown by the agent : java.lang.NullPointerException
2025-02-18 11:39:04 java.lang.NullPointerException
2025-02-18 11:39:04 at java.base/jdk.internal.platform.cgroupv2.CgroupV2Subsystem.getInstance(CgroupV2Subsystem.java:81)
2025-02-18 11:39:04 at java.base/jdk.internal.platform.CgroupSubsystemFactory.create(CgroupSubsystemFactory.java:113)
2025-02-18 11:39:04 at java.base/jdk.internal.platform.CgroupMetrics.getInstance(CgroupMetrics.java:167)

```

---

<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:** [18 February 2025 15:16 UTC](https://forum.confluent.io/t/kafka-docker-compose-stopped-working/37281/2 "2025-02-18T15:16:01Z")

</div>

This looks like a [Docker issue](https://github.com/docker/for-mac/issues/7573) impacting a lot of examples. I am able to run the example with Docker Desktop 4.37.1 but hit the same stacktrace after upgrading to 4.38.0. I can also repro the ElasticSearch repro [here](https://github.com/docker/for-mac/issues/7573#issuecomment-2630600774) after upgrading Docker Desktop.

What OS and Docker version do you have? You can downgrade [here](https://docs.docker.com/desktop/release-notes/#4372) if you’re on 4.38.0.

---

<div class="post-metadata">

**Author:** ![jedrekd](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/jedrekd/32/1093_2.png) [@jedrekd](https://forum.confluent.io/u/jedrekd)\
**Post date:** [19 February 2025 21:53 UTC](https://forum.confluent.io/t/kafka-docker-compose-stopped-working/37281/3 "2025-02-19T21:53:19Z")

</div>

I’m on 4.38.0. This is not good ☹ I might need to downgrade. Thanks for the update.

---

<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:** [20 February 2025 14:29 UTC](https://forum.confluent.io/t/kafka-docker-compose-stopped-working/37281/4 "2025-02-20T14:29:24Z")

</div>

I’m hoping that this gets resolved in the next Docker Desktop release. Asked [here](https://github.com/docker/for-mac/issues/7573#issuecomment-2671649957) in the GitHub issue.

Another option for you is to switch over to KRaft mode as this seems to only be impacting `cp-zookeeper`. You might want to consider that regardless of this issue, and also get on the latest version of Confluent Platform. I tested [this example](https://github.com/confluentinc/cp-all-in-one/blob/63518b1d964e3629a823fb70fcef573371ddf755/cp-all-in-one/docker-compose.yml) on Docker Desktop 4.38.0 and didn’t hit this problem.
