Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue to access KSQL CLI on Docker

I'm trying access the KSQL CLI for first time on Windows terminal but I got the error: Unable to find image 'cp-ksql-cli:5.3.1' locally

To do it I get docker images

$ docker images
REPOSITORY                                  TAG                 IMAGE ID            CREATED             SIZE
cnfldemos/kafka-connect-datagen             0.1.3-5.3.1         f88aea51c605        2 weeks ago         1.03GB
confluentinc/ksql-examples                  5.3.1               b9fb66d15198        4 weeks ago         499MB
confluentinc/cp-ksql-server                 5.3.1               7c40b5e474a2        4 weeks ago         522MB
confluentinc/cp-ksql-cli                    5.3.1               a488fb1cc028        4 weeks ago         510MB
confluentinc/cp-enterprise-kafka            5.3.1               2b5ee743a097        4 weeks ago         646MB
confluentinc/cp-enterprise-control-center   5.3.1               c29150c8588e        4 weeks ago         771MB
confluentinc/cp-schema-registry             5.3.1               b7abcb36a4d9        4 weeks ago         986MB
confluentinc/cp-kafka-rest                  5.3.1               27066ec8dcc2        4 weeks ago         984MB
confluentinc/cp-zookeeper                   5.3.1               711eb38827f6        4 weeks ago         590MB

So:

$ docker run cp-ksql-cli:5.3.1 http://ksql-server:8088

also it:

$ docker run confluentinc/cp-ksql-cli:5.3.1 http://ksql-server:8088

and got the error:

Unable to find image 'cp-ksql-cli:5.3.1' locally

I'am a new on KSQL and I don't know if this is the correct way to access the CLI. On the google I found this tutorial but I can't understanted how enter on the KSQL CLI terminal. Besides that I don't know how it connect with my Kafka broker, zookeper and others..

SOLVED

Accessed using: $ docker-compose exec ksql-cli ksql http://ksql-server:8088

like image 220
Augusto Avatar asked Mar 31 '26 05:03

Augusto


2 Answers

I don't know how it connect with my Kafka broker, zookeper and others..

KSQL CLI doesn't. Kafka is connected to Zookeeper, and KSQL server is connected to Kafka.

KSQL CLI only connects to KSQL Server.

Therefore, you need a total of at least 4 containers to be running at once, which is why Docker Compose is recommended, as the tutorial you linked to shows.

the correct way to access the CLI

It should be like this, where some_network is a Docker network that already hosts a ksql-server container

docker run --rm -ti --network=some_network confluentinc/cp-ksql-cli:5.3.1 http://ksql-server:8088

(or longer version shown in the tutorial is docker run --network some_network --rm --interactive --tty ...)

like image 158
OneCricketeer Avatar answered Apr 02 '26 18:04

OneCricketeer


I think it's because you didn't open the 8088 port. Checkout below docker commands.

1) KSQL server docker start

$ docker run \
    -p 127.0.0.1:8088:8088 \
    -e KSQL_BOOTSTRAP_SERVERS=localhost:9092 \
    -e KSQL_LISTENERS=http://0.0.0.0:8088/ \
    -e KSQL_KSQL_SERVICE_ID=ksql_standalone_1_ \
    confluentinc/cp-ksql-server:5.3.1

2) KSQL-cli docker start

$ docker run --net=host --interactive --tty \
    confluentinc/cp-ksql-cli:5.3.1 \
    http://localhost:8088

If you do this, it will work out. Good luck.

like image 43
Anderson Choi Avatar answered Apr 02 '26 17:04

Anderson Choi