How to use Confluent CLI on docker
Asked Answered
T

2

12

I have started Confluent Platform on my windows 10 using docker with the help of https://docs.confluent.io/current/quickstart/ce-docker-quickstart.html. Now I want to try using Confluent CLI. But I don't see any documentation on how to use confluent cli on docker. Can you please suggest me how can I do this !

Titrant answered 28/4, 2020 at 10:9 Comment(6)
When you use commands like kafka-console-consumer you'd use the host name and a published port as the --bootstrap-server. You shouldn't need the confluent command since all of the components are started by the provided Docker Compose setup. Is there a specific problem you're encountering, or a specific command you can't run?Eurythmic
docs.confluent.io/current/cli/installing.htmlBulk
thank you @BMW, I am able to use confluent-cli from docker now using the scripted installation steps providedTitrant
@Bulk I have the below services running on Docker. When I try to do anything on confluent-cli, it's expecting an url to be set. What url must I use ? Should I use one of the below url's ? broker - 0.0.0.0:9092->9092/tcp control-center - 0.0.0.0:9021->9021/tcp zookeeper - 0.0.0.0:2181->2181/tcp, 2888/tcp, 3888/tcpTitrant
@JB- do you have an example of what you are wanting to use the Confluent CLI for?Dermot
@RobinMoffatt I am trying to explore how to manage permissions using confluent-cli using the iam commandTitrant
K
6

Confluent does not provide a docker image for the CLIs at this time (that I'm aware of). Until that time, you could build a simple image locally to package up the CLI for experimenting w/ the command.

Create Dockerfile:

FROM ubuntu:latest

RUN apt update && apt upgrade
RUN apt install -y curl
RUN curl -L --http1.1 https://cnfl.io/cli | sh -s -- -b /usr/local/bin

Then build with:

docker build -t confluent-cli:latest .

Then run on the cp-all-in-one network with:

$ docker run -it --rm --network="cp-all-in-one_default" confluent-cli:latest bash

Then from the containers shell, experiement w/ the command:

root@421e53d4a04a:/# confluent
Manage your Confluent Platform.

Usage:
  confluent [command]

Available Commands:
  cluster     Retrieve metadata about Confluent clusters.
  completion  Print shell completion code.
  help        Help about any command
  iam         Manage RBAC, ACL and IAM permissions.
  local       Manage a local Confluent Platform development environment.
  login       Log in to Confluent Platform (required for RBAC).
  logout      Logout of Confluent Platform.
  secret      Manage secrets for Confluent Platform.
  update      Update the confluent CLI.
  version     Print the confluent CLI version.

Flags:
  -h, --help            help for confluent
  -v, --verbose count   Increase verbosity (-v for warn, -vv for info, -vvv for debug, -vvvv for trace).
      --version         version for confluent

Use "confluent [command] --help" for more information about a command.
Kaoliang answered 28/4, 2020 at 13:32 Comment(4)
Thank you @Rick, I'm going to try this now. Could you please assist me with how to use this cli to manage permissions on control center using iamTitrant
@JB I'm sorry to say that the cp-all-in-one compose files do not bootstrap RBAC for Confluent Platform. One suggestion I have for you is to look at cp-demo (github.com/confluentinc/cp-demo) which does enable RBAC using LDAP. The demo has scripts which you can investiagte for usage.Kaoliang
@RickSpurgeon did you manage to login to the local cluster using confluent cli?Sinasinai
confluent login --url localhost:8091 --ca-cert-path scripts/security/snakeoil-ca-1.crt works but i cannot see clustersSinasinai
S
3

Here is the image:

https://hub.docker.com/r/confluentinc/confluent-cli

Basically run the following commands:

devbox1@devbox1:~/onibex/wa$ docker pull confluentinc/confluent-cli
devbox1@devbox1:~/onibex/wa$ docker run confluentinc/confluent-cli

To check if the image was added:

devbox1@devbox1:~/onibex/wa$ docker ps -a | grep confluent-cli
a5ecf9223d35   confluentinc/confluent-cli

                     

Add "sudo" if it is needed.

Substratum answered 4/3, 2022 at 0:18 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.