DEV Community

David McKay for InfluxData

Posted on

Spinning Up InfluxDB 2.0 (Alpha) with Docker

Warning: InfluxDB 2.0 (Alpha) should NOT be used for any production workloads.

While InfluxData, the company behind InfluxDB, does not provide packages for alpha builds; we do run our own alpha's for various testing and performance purposes. For this, we provide a public Docker image through Quay.io.

Getting Started

Running with Docker

docker container run --port 9999:9999 quay.io/influxdb/influxdb:2.0.0-alpha
Enter fullscreen mode Exit fullscreen mode

Running with Docker Compose

version: "3"

services:
  influxdb:
    image: quay.io/influxdb/influxdb:2.0.0-alpha
    ports:
      - "9999:9999"
Enter fullscreen mode Exit fullscreen mode

Persistance

If you need to persist your database across container restarts, you may feel free to add a volume mount directory /root/.influxdbv2.

Configuring InfluxDB 2.0 (Alpha)

Now that you have a container running, you'll need to configure things. InfluxDB 2.0 is different from previous releases in that authentication cannot be ignored or disabled. InfluxDB 2.0 is also multi-tenant, which means you'll need to specify an organisation for your user during setup.

Using the GUI

You can configure everything through our GUI, using https://localhost:9999.

Using the CLI

You can configure everything through our CLI, though you'll need to get "inside" the container first.

# Docker
docker container exec -it container_name bash

# Docker Compose
docker-compose exec influxdb bash
Enter fullscreen mode Exit fullscreen mode

Now that you're inside the container, you can use our setup command to configure everything interactively:

influx setup
Enter fullscreen mode Exit fullscreen mode

If you'd like to do this through a script, you can also use the command line flags:

Flags:
  -b, --bucket string     primary bucket name
  -f, --force             skip confirmation prompt
  -h, --help              Help for the setup command
  -o, --org string        primary organization name
  -p, --password string   password for username
  -r, --retention int     retention period in hours, else infinite (default -1)
  -u, --username string   primary username
Enter fullscreen mode Exit fullscreen mode

API Token

Specifying a token during setup will also allow you to set the API token for future requests. Omitting this will have one generated for you and stored in /root/.influxdbv2/credentials (Inside the container).

You can specify the token as such:

-t, --token string   API token to be used throughout client calls
Enter fullscreen mode Exit fullscreen mode

That's it! Now you've got a working InfluxDB 2.0 ready for data.

Have fun!

Top comments (0)