InfluxDB v2 nfs volume issue "chown: changing ownership of '/var/lib/influxdb2': Operation not permitted"
When execute "docker run -p 8086:8086 --name influxdb2 -v ${NFS_INFLUX_DIR}:/var/lib/influxdb2 influxdb:2.1.1", it always fails with error msg "chown: changing ownership of '/var/lib/influxdb2': Operation not permitted". ${NFS_INFLUX_DIR} is a mount point on NFS.
I have the same problem, as workaround I created a new docker image as following
FROM influxdb:2.2.0-alpine
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
CMD ["influxd"]
EXPOSE 8086
ENV INFLUX_CONFIGS_PATH /etc/influxdb2/influx-configs
ENV INFLUXD_INIT_PORT 9999
ENV INFLUXD_INIT_PING_ATTEMPTS 600
ENV DOCKER_INFLUXDB_INIT_CLI_CONFIG_NAME default
I removed block code that start from line 108 in [entrypoint.sh] (https://github.com/influxdata/influxdata-docker/blob/master/influxdb/2.3/alpine/entrypoint.sh#L108)
Now you can change the value of helm chart with your docker image
image:
repository: <your_image_name>
tag: <tag>
pullPolicy: Always
pullSecrets:
- <docker-registry-secret>
Is there a fix for this? I'm running 2.7.1-alpine and have encountered this problem, doing Bind Mounts to a NFS space.
@cindyjiawq / @bacterik Did you guys found anything apart from making changes in the Docker image which might be helpful . As seeing same issue
I have possibly the same issue although the message is slightly different. For me it's like:
chown: changing ownership of '/var/lib/influxdb2/engine/data/@eaDir/_series/05/0000': Invalid argument chown: changing ownership of '/var/lib/influxdb2/engine/data/@eaDir/_series/00': Invalid argument chown: changing ownership of '/var/lib/influxdb2/engine/data/@eaDir/_series/00/0000': Invalid argument
i am able to mount the directory to the file system and create a test-file without sudo or anything else. Starting the container brings me the log full of the messages. The NFS permissions is basically mapping everything to admin. I tried everything at this point. I really don't understand why it's such a problem. I don't want to start managing an own docker file for this.
Please help
有解决方案吗?
This has worked for me in kubernetes, Use at your own risk. It replaces the line in a if statement.
apiVersion: apps/v1
kind: Deployment
metadata:
annotations: {}
creationTimestamp: null
generation: 1
labels:
app: influxdb
name: influxdb
namespace: observability
spec:
replicas: 1
selector:
matchLabels:
app: influxdb
template:
metadata:
creationTimestamp: null
labels:
app: influxdb
spec:
containers:
- image: influxdb:2.3.0-alpine
imagePullPolicy: Always
name: influxdb
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
env:
- name: INFLUXDB_ADMIN_USER_PASSWORD
valueFrom:
secretKeyRef:
name: influx-db-admin-password
key: influx-db-admin-password
ports:
- containerPort: 8086
command: ["/bin/bash", "-c"]
args:
- |
sed -i 's/${user} = 0/${user} = 1/g' /entrypoint.sh;
/entrypoint.sh;