How to use Confluent CLI on docker

3.3k views Asked by At

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 !

2

There are 2 answers

4
Rick Spurgeon On BEST ANSWER

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.
0
Luis Estrada On

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.