Pull the latest version of influxdb official image :
docker pull influxdb
Or pull specific version of influxdb official image :
docker pull influxdb:<version>
Create a directory for influxdb data volume and change directory to it:
mkdir ~/influxtest && cd ~/influxtest
Run influxdb container:
docker run --name influxtest -d -p 8086:8086 \
-v $PWD:/var/lib/influxdb \
influxdb
For run with custom config file :
First generate default configuration file :
docker run --rm influxdb influxd config > influxdb.conf
If you want to enable user authentication on http, enable auth-enabled
option in config file:
[http]
...
auth-enabled = true
...
Then create an admin user :
docker run --rm --link=influxtest -it influxdb influx -host influxtest -execute "CREATE USER myname WITH PASSWORD '123456' WITH ALL PRIVILEGES"
Then run the container:
docker run --name influxtest -d -p 8086:8086 \
-v $PWD:/var/lib/influxdb \
-v $PWD/influxdb.conf:/etc/influxdb/influxdb.conf:ro \
influxdb -config /etc/influxdb/influxdb.conf
Run influxdb cli client in another container linked to influxtest container:
docker run --rm --link=influxtest -it influxdb influx -host influxtest
If you enable user authentication, authenticate your user first:
auth
Create a new database:
CREATE DATABASE <dbname>
Show list of databases:
SHOW DATABASES
Use a database:
USE <dbname>