How to run commands using CLI when running a docker

I’m able to run influxdb shell on my local CL and run commands like “show databases” and “create databases” but when I have it running on docker using “docker exec -it container_Name bash” and try using the same queries I keep getting ‘Use “influx [command] --help” for more information about a command.’

how can I run the above queries on docker CLI? (If there’s documentation page for this can you please share it as I was not able to find it)

I still use it as a vanilla systemd service , but I just came across this docker blog post - hope it’s useful

If you’ve followed the defaults in the tutorial , you should be able to point your local web browser at http://localhost:8086 and be able to interact with the GUI from there. I believe you can do similar other influx cmdline tool as well.

@riz it sounds like you might be unexpectedly pulling a 2.x version of the Docker build, when you’re expecting to be able to use a 1.x CLI. The 2.x CLI doesn’t support an interactive shell, so you’ll need to explore the help text & docs to find the commands-to-run. If you’re looking to keep an interactive workflow, you’ll need to use the built-in UI as suggested by @FixTestRepeat.

Since I couldn’t find any step-by-step guide for accessing the CLI in Docker I decided to respond to this.
I’m a Windows guy myself so I might be telling a few obvious things…

Getting to the linux-prompt from Docker Desktop:

  • Click the >_ icon of the running InfluxDB container and a console will open.
  • Here you can type influx commands like “influx -h” for help.

That all works fine until you try something serious like listing the organizations:

  • After typing “influx org list” you will get an error 401 (not logged in)

So,how do you log in?
That is not very straight forward. You have to create a CLI config:
influx config create --config-name Bert
–host-url http://localhost:8086
–org Kortenbach\ P&A
–token DE2HKRJenCSSE-p8dhuFu_z4V1mROrjZ-_zZcrtifK_s-dg0UP5WpWZLfXPzV0og==
The name of the organization above is kortenbach P&A. You need to escape the space and & character by adding a backspace in front. Enter this text in notepad and modify it for your setup (the token can be copied from the InfluxDB UI in the browser (under Data–>API tokens). When you’re done copy and paste the whole command in in the CLI.
After you do this you can list the organizations.
Note that the list shows the organization name as well as an ID. You will need this ID if you want to, for instance, delete an organization (don’t use the organization NAME for that).

If this is helpfull please leave a comment!