# Troubleshoot Deployment of Kafka Docker Image

**URL:** <https://forum.confluent.io/t/troubleshoot-deployment-of-kafka-docker-image/7888>\
**Category:** Ops\
**Created:** [17 May 2023 16:14 UTC](https://forum.confluent.io/t/troubleshoot-deployment-of-kafka-docker-image/7888 "2023-05-17T16:14:37Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![daftpunkapi](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@daftpunkapi](https://forum.confluent.io/u/daftpunkapi)\
**Post date:** [17 May 2023 16:14 UTC](https://forum.confluent.io/t/troubleshoot-deployment-of-kafka-docker-image/7888/1 "2023-05-17T16:14:37Z")

</div>

I am trying to deploy a `docker-compose.yaml` on a public cloud VM. There is no other file I would like to deploy

My file that contains 3 images to build the container (see code below): Kafka Broker, Zookeeper and Python-Producer (which basically just produces random numbers periodically and writes to a Kafka Topic; and this image is deployed publicly).

I have followed 2 comprehensive tutorials on how to deploy a container on VM using GCP & AWS EC2 meticulously. But I am getting the following errors

- On AWS EC2 on Linux → I am unable to install docker-compose engine
- On GCP VM on Ubuntu → I am able to run docker-compose up command but it throws an error stating the broker cannot be started

Link to AWS Deploy tutorial: [https://www.youtube.com/watch?v=gRgdnHHuvoI&t=142s](https://www.youtube.com/watch?v=gRgdnHHuvoI&t=142s)

Link to GCP Deploy Tutorial: [https://www.youtube.com/watch?v=nt7fpz4JXzY](https://www.youtube.com/watch?v=nt7fpz4JXzY)

version: ‘2’

services:  
zookeeper:  
image: confluentinc/cp-zookeeper:latest  
hostname: zookeeper  
container\_name: zookeeper  
ports:  
- “2181:2181”  
environment:  
ZOOKEEPER\_CLIENT\_PORT: 2181  
ZOOKEEPER\_TICK\_TIME: 2000

broker:  
image: confluentinc/cp-kafka:latest  
hostname: broker  
container\_name: broker  
depends\_on:  
- zookeeper  
ports:  
- “29092:29092”  
- “9092:9092”  
- “9101:9101”  
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\_OFFSETS\_TOPIC\_REPLICATION\_FACTOR: 1  
KAFKA\_TRANSACTION\_STATE\_LOG\_MIN\_ISR: 1  
KAFKA\_TRANSACTION\_STATE\_LOG\_REPLICATION\_FACTOR: 1  
KAFKA\_GROUP\_INITIAL\_REBALANCE\_DELAY\_MS: 0

producer:  
image: daftpunkapi/flink\_v1:latest  
depends\_on:  
- broker  
restart: “on-failure”

Any help and guidance will be much appreciated - TIA!

---

<div class="post-metadata">

**Author:** ![OneCricketeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/onecricketeer/32/1551_2.png) [@OneCricketeer](https://forum.confluent.io/u/OneCricketeer)\
**Post date:** [17 May 2023 19:36 UTC](https://forum.confluent.io/t/troubleshoot-deployment-of-kafka-docker-image/7888/2 "2023-05-17T19:36:17Z")

</div>

Are you getting a specific error you’d like to share?

1. “Docker-compose engine” does not need installed `docker compose` is a command built-in to Docker Engine itself. (Notice the lack of a hyphen)
2. Kafka broker does not start immediately. You need to make your Python code wait.
3. If you are only wanting to connect to Kafka from Python, you can remove the localhost:9092 listener and all ports defined on the kafka and zookeeper containers.

---

<div class="post-metadata">

**Author:** ![daftpunkapi](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@daftpunkapi](https://forum.confluent.io/u/daftpunkapi)\
**Post date:** [18 May 2023 15:29 UTC](https://forum.confluent.io/t/troubleshoot-deployment-of-kafka-docker-image/7888/3 "2023-05-18T15:29:52Z")

</div>

Hi

Thank you, I did not realize that docker-compose had been deprecated.  
And now I am finally able to use the docker compose command to spin up containers using my YAML file.

I edited the yaml file to remove the python image and now it consists of only the zookeeper and kafka broker services. However containers keep exiting for kafka broker.  
The zookeeper does not exit and runs smoothly. I also changed the docker compose yaml file and edited the PLAINTEXT\_HOST to :9092

### The log for the container looks like -

OpenJDK 64-Bit Server VM warning: INFO: os::commit\_memory(0x00000000c0000000, 1073741824, 0) failed; error=‘Not enough space’ (errno=12)  
There is insufficient memory for the Java Runtime Environment to continue.  
Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.  
An error report file with more information is saved as:  
/home/appuser/hs\_err\_pid1.log

### Is this related to the EBS volume attached to the instance ??

### (I am using a free tier EC2 instance with 1 GB EBS volume)

---

<div class="post-metadata">

**Author:** ![OneCricketeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/onecricketeer/32/1551_2.png) [@OneCricketeer](https://forum.confluent.io/u/OneCricketeer)\
**Post date:** [18 May 2023 20:17 UTC](https://forum.confluent.io/t/troubleshoot-deployment-of-kafka-docker-image/7888/4 "2023-05-18T20:17:21Z")

</div>

EBS is storage, not memory. Your error is saying that the RAM was exhausted. You will need a minimum of 4GB of RAM to run both Zookeeper and Kafka together on the same machine with Docker Compose.

---

<div class="post-metadata">

**Author:** ![OneCricketeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/onecricketeer/32/1551_2.png) [@OneCricketeer](https://forum.confluent.io/u/OneCricketeer)\
**Post date:** [18 May 2023 20:19 UTC](https://forum.confluent.io/t/troubleshoot-deployment-of-kafka-docker-image/7888/5 "2023-05-18T20:19:32Z")

</div>

> [@daftpunkapi](#):
>
> free tier EC2 instance

T3 Micro only has 1GB of memory available.

Is there a specific reason you cannot install Docker locally? Do you really need AWS/GCP to run services? And if so, you could use Confluent Cloud, rather than Docker.

---

<div class="post-metadata">

**Author:** ![daftpunkapi](https://avatars.discourse-cdn.com/v4/letter/d/6bbea6/32.png) [@daftpunkapi](https://forum.confluent.io/u/daftpunkapi)\
**Post date:** [28 May 2023 10:05 UTC](https://forum.confluent.io/t/troubleshoot-deployment-of-kafka-docker-image/7888/6 "2023-05-28T10:05:34Z")

</div>

Just wanted to test out AWS EC2 services and since I was working on a project, thought I would deploy that itself.

I did provision a T3.large resource and it worked perfectly.

Thank you for the help!!

---

<div class="post-metadata">

**Author:** ![OneCricketeer](https://sea1.discourse-cdn.com/flex019/user_avatar/forum.confluent.io/onecricketeer/32/1551_2.png) [@OneCricketeer](https://forum.confluent.io/u/OneCricketeer)\
**Post date:** [4 June 2023 12:27 UTC](https://forum.confluent.io/t/troubleshoot-deployment-of-kafka-docker-image/7888/7 "2023-06-04T12:27:57Z")

</div>

EC2-based Kafka clients can also connect to Confluent Cloud with VPC peering or PrivateLink.
