Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where is the kafka bin to access the sh files in kafka docker container - confluentinc/cp-kafka:latest

Where is the kafka/bin location to access kafka shell scripts for the commands like

kafka-topics --bootstrap-server kafka:9092 --list

This results in a blank response. I created topic from docker compose command attribute.

I tried searching,

/etc/kafka # This has only properties files
/opt/ # No subdirectories listed here

I am using the confluentinc/cp-kafka:latest image for spawning the docker image

kafka:
image: confluentinc/cp-kafka:latest
depends_on:
  - zookeeper
ports:
  - 29092:29092
expose:
  - 29092
environment:
  KAFKA_BROKER_ID: 1
  KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
  KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
  KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
  KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
  KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1

The docker container is running properly. I need to know :

  • how to test manually from terminal within
  • where is the kafka shell scripts

Thanks!

like image 657
Nilotpal Avatar asked Oct 16 '25 01:10

Nilotpal


2 Answers

I would check under /usr/bin, but you do not need the absolute path. The scripts are already on the shell PATH.

created topic from docker compose command

This would override the existing container entrypoint command which starts the broker, unless you mean docker compose exec kafka "kafka-topics --create ..."

like image 124
OneCricketeer Avatar answered Oct 18 '25 14:10

OneCricketeer


Open a shell:

$ docker container ps 
$ docker exec -it <container_id> /bin/sh

Find the path to kafka shell scripts:

$ find -name kafka-topics.sh

This command show all kafka's scripts on current docker image:

$ cd /opt/kafka/bin && ls

Kafka docs shows how to do the rest basic operations.

like image 33
Gleichmut Avatar answered Oct 18 '25 16:10

Gleichmut