influxdata / influxdata/influxdata-docker

Running in rootless docker is nonfunctional with host filesystem bind mounts due to overriden user ID inside container

Open
#716 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
Shell
Stars
364
Forks
255
Avg merge
3h 18m
Merged PRs (30d)
7

Description

I'm using a docker-compose.yml file to orchestrate setup. Data has not been showing up in Influx since I started trying to set it up. After several hours of digging, I noticed the bind mounts I had set up in the `docker-compose.yml` file had an unusual user ID attached:
```
as sudo niko@niko-desktop docker-compose-influxdb-grafana > ls -lh data/
total 8.0K
drwxr-xr-x 1 niko niko 62 Nov 1 15:34 grafana/
drwx------ 1 100999 niko 40 Nov 1 15:37 influx/
drwxrwxr-x 1 100999 niko 28 Nov 1 14:41 influx-config/
```
This persists despite user ID 0 being forced in the docker-compose.yml file, which maps to my true user on the host system in a rootless setup:
```
version: '2'
services:
influxdb:
image: influxdb:latest
ports:
- '8086:8086'
user: "0:0"
volumes:
- ./data/influx:/var/lib/influxdb2
- ./data/influx-config:/etc/influxdb2
environment:
- DOCKER_INFLUXDB_INIT_MODE=setup
- DOCKER_INFLUXDB_INIT_USERNAME=redacted
- DOCKER_INFLUXDB_INIT_PASSWORD=redacted
- DOCKER_INFLUXDB_INIT_ORG=weather
- DOCKER_INFLUXDB_INIT_BUCKET=main
grafana:
image: grafana/grafana:latest
ports:
- '3000:3000'
user: "0:0"
volumes:
- ./data/grafana:/var/lib/grafana
- ./grafana-provisioning/:/etc/grafana/provisioning
depends_on:
- influxdb
environment:
- GF_SECURITY_ADMIN_USER=${GRAFANA_USERNAME}
- GF_SECURITY_ADMIN_PASSWORD=${GRAFANA_PASSWORD}
```
Grafana complains once at startup that it's running as a privileged user, when in actuality it is running as my user. However, InfluxDB fails silently with no permissions errors or anything of the sort mentioned in logs. The only reason I eventually figured this out was because of a GitHub issue: https://github.com/itzg/docker-minecraft-server/issues/1934#issuecomment-1407581582

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the docker-compose.yml shown in the report and reproduce the rootless Docker setup using the InfluxDB and Grafana services with host bind mounts. Check how the mounted directories are owned and how InfluxDB behaves at startup; done means the services can use the bind mounts and InfluxDB reports or exposes permission failures instead of failing silently.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, docker-compose
Domain
devops, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.