How can I access CLI when I installed InfluxDB using Docker on my laptop

Hello Community, I pulled InfluxDB using Docker. I am unable to figure out how to interact with InfluxDB using CLI but the HTTP API works great

For example:
[curl -i -XPOST http://localhost:8086/query --data-urlencode “q=CREATE DATABASE mydb”
]

How can I access InfluxDb docker using CLI?

Please advice.

Thanks,
Sree

@reddy You need to make sure to expose the port when creating your InfluxDB docker container:

docker run -it -p 8086:8086 influxdb

I you are experimenting with Docker and InfluxDB as a way of learning the database can I suggest our recently released Sandbox. This runs the full stack in docker all hooked up. It also does this by default.

Hope that helps!

P.S. Heres the blog post about it.

@jackzampolin thank you so much for your quick reply. The sandbox is exactly wanted i needed!! I was thinking of creating one myself :slight_smile: but you reduced my pain.

But coming back to my previous question, yes i did expose the port [8086] but I am not sure how to make InfluxDB queries through CLI, I can successfully make the HTTP API calls to Create DB, Write, Read etc.

Please let me know if I am missing something,
Sree

@jackzampolin Also will the sandbox work on Windows? or No? Blog seems to just suggest Mac and Linux [but if you are using Docker I am curious why not Windows?]

@reddy Would you help me debug it on Windows? I haven’t had a chance to try. No reason it shouldn’t.

@jackzampolin Sure would love to. I have both Mac and Windows that I use. Let me get it going on Mac, once I have it working E2E on Mac, I will jump on Windows and let you know if I run into any issues.

2 Likes