influxdata / influxdata-docker

Official docker images for the influxdata stack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error in plugin: Got permission denied while trying to connect to the Docker daemon socket

rsuplina opened this issue · comments

Hello I'm hitting an issue while trying to setup InfluxDB with Telegraf

ls -ln /var/run/docker.sock | awk '{print $4}'

1

THIS IS MY telegraf docker-compose part

  telegraf:
    image: telegraf:1.19
    container_name: telegraf
    user: telegraf:1
    volumes:
      - ./telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:rw
      - /var/run/docker.sock:/var/run/docker.sock
    env_file:
      - .env
    depends_on:
      - influxdb

and my error

telegraf       | 2023-05-09T16:23:00Z E! [inputs.docker] Error in plugin: 
Got permission denied while trying to connect to the Docker daemon socket 
at unix:///var/run/docker.sock: Get "http://%2Fvar%2Frun%2Fdocker.sock/v1.21/containers/json?
filters=%7B%22status%22%3A%5B%22running%22%5D%7D&limit=0":
 dial unix /var/run/docker.sock: connect: permission denied

ls -ln /var/run/docker.sock | awk '{print $4}'
1

That's an odd group ID for the docker socket. Are you certain it is 1? Can you show stat /var/run/docker.sock?

I would also suggest jumping into the telegraf container and running the same command.