I am running influxdb with docker-compose and has been working perfectly, however now I want to precreate database with docker-compose file. I tried providing env variable to do so, but does not seem to work. Is there something wrong in the way I am doing it?
version: '2'
services:
#Install latest influxdb docker image from docker-hub: https://hub.docker.com/_/influxdb/
influxdb:
container_name: influxdb
image: influxdb:latest
ports:
- "8086:8086"
- "8083:8083"
- "8090:8090"
- "8099:8099"
environment:
INFLUXDB_DATA_ENGINE: tsm1
PRE_CREATE_DB: "smash-db"
Shouldn't be :
"- PRE_CREATE_DB: "smash-db"
Just missing the "-" at the start of the line can you try ? Same for data engine line i think.
Best
@Yakha I think env variables can be declared without "-", there is some issue, I believe.
Um... I'm admittedly a bit confused. I've never seen that line and am not aware of the influxdb docker image having this capability at the moment. It's been requested, but I haven't had time to ensure the functionality will work in a maintainable way so I have pushed off deciding on that.
It seems to me this issue is related to influxdata/influxdata-docker#75?
@jsternberg I saw it in here: https://hub.docker.com/r/tutum/influxdb/ and I thought tutum-docker image has been merged with official influxdb image so, looking at to PRE_CREATE_DATABASE in there, I thought it must be there. If the functionality is not there to pass this is as env-variable then I can use Http call to do the same, but want to make sure before that
Ah, that makes more sense. The official image is not based off of the tutum/influxdb image. As of now, you need to use an http call. You can keep an eye out though on the above issue since I get enough requests for that issue that I'll need to have a solution for it at some point.
you can see the official container init script here 馃憤 https://github.com/influxdata/influxdb/blob/master/docker/init-influxdb.sh