Change .influx_history default file location in Docker container

Hi,

I currently have an InfluxdDB 1.7.9 Alpine Docker container running inside a Kubernetes cluster. The InfluxDB container spins up fine and I’m able to write data to it from my Telegraf containers running in the same cluster.

Whenever I shell into the InfluxDB container and try to execute any commands inside the DB I get the following error message:

“There was an error writing history file: open /.influx_history: permission denied”

When I check my ID in the shell I see this:
bash-4.4$ id
uid=100 gid=0(root) groups=0(root)

I can’t write anything in the / partition:
bash-4.4$ pwd
/
bash-4.4$ touch test
touch: test: Permission denied

Is it possible to configure the .influx_history file be written somewhere else? I have read/write access to the /var/lib/influxdb directory and wanted to write the .influxd_history file there but don’t know if this is even possible?

Hello @mohsin106 ,
I didn’t know the answer so I phoned a friend :p. His response:
" that user , uid=100, does not probably have a proper home env variable set. I assume that .influx_history will be written to the user home directory so he could just export an HOME=<somewhere_where_user_100_can_write> ( like /tmp or /var/lib/influxdb ) in the manifest starting the influx pod
I did start the official alpine 1.7.9 influxdb image and i can’t see that user 100 so either he is setting that user in the context of the pod on startup or is a custom image, in that case he could also set the home properly for that user at creation time in the dockerfile"

Thank you that worked.
I’m using the 1.7 Alpine image from here (influxdata-docker/influxdb/1.7/alpine at master · influxdata/influxdata-docker · GitHub).

When the container booted up in Rancher I did the below since I have write access in the /var/lib/influxdb directory.

bash-4.4$ export HOME=“/var/lib/influxdb”
bash-4.4$ echo $HOME
/var/lib/influxdb

1 Like