Nilotpal
Nilotpal

Reputation: 3588

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 :

Thanks!

Upvotes: 4

Views: 3005

Answers (3)

Tingwei
Tingwei

Reputation: 3

I used these commands to get the cluster id.

docker run -it --rm confluentinc/cp-kafka:latest bash

/bin/kafka-storage random-uuid

Upvotes: 0

Gleichmut
Gleichmut

Reputation: 6989

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.

Upvotes: 1

OneCricketeer
OneCricketeer

Reputation: 191894

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 ..."

Upvotes: 4

Related Questions