Docker container | VCHI initialization failed

Hey everyone.
I’m currently in the process of setting up Telegraf, InfluxDB and Grafana within Docker using Portainer.
Everything is working fine, except for Telegraf which is causing me some issues.

This is my docker-compose file for it

services:
  telegraf:
    hostname: raspberrypi3b
    container_name: git_telegraf
    image: telegraf:latest

    volumes:
    - /home/pi/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
    - /var/run/docker.sock:/var/run/docker.sock:ro

    - /usr/bin/vcgencmd:/usr/bin/vcgencmd
    - /usr/lib/arm-linux-gnueabihf/libvcos.so.0:/usr/lib/arm-linux-gnueabihf/libvcos.so.0
    - /usr/lib/arm-linux-gnueabihf/libvchiq_arm.so.0:/usr/lib/arm-linux-gnueabihf/libvchiq_arm.so.0
            
    devices:    
    - "/dev/vchiq"
    ports:
    - '8125:8125/udp'

The issues is that I keep getting VCHI initialization failed and so far the only way of fixing this is to connect to the docker container and execute the following command: chmod 766 /dev/vchiq
So it seems that it’s some sort of permission issue but I have no clue what to do against it at this point.
I’ve tried the following things by adding them to the docker-compose file:
user: root
privileged: true

group_add:
      - video

None of which have worked at all.
Does anybody have any suggestions? I would greatly appreciate it.

Make sure the user is in the video group. You can test this by running vcgencmd version as the user.

Sorry for the late reply.
I checked and the user isn’t inside the group.
I tried adding the user to the group within the docker compose file with

group_add:
      - video

but that doesn’t seem to work.

Have you tried logging into the container and ensuring that the command outside of telegraf works (e.g. run the vcgencmd` version as the user).

I connected to the container and I’m able to run the vcgencmd command.
Also I checked to see under which user the container is running and what groups it was part of, which showed me it was telegraf (999).
Even though I tried adding the user to the video group within the docker-compose it didn’t show that it was part of that group.
However when I manually connected to the docker as the same user telegraf (999), I was able to see that I am in the group video.
I’m not sure what’s going on here…