Error in autodiscover provider settings: error setting up docker autodiscover provider

When I try to setup filebeat I get this error: filebeat | Exiting: error in autodiscover provider settings: error setting up docker autodiscover provider: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?

my filebeat docker compose

services:
  filebeat:
    build:
      context: filebeat/
      args:
        ELK_VERSION: $ELK_VERSION
    container_name: filebeat
    user: root
    command:
        # Log to stderr.
      - -e
        # Disable config file permissions checks. Allows mounting
        # 'config/metricbeat.yml' even if it's not owned by root.
        # see: https://www.elastic.co/guide/en/beats/libbeat/current/config-file-permissions.html
      - --strict.perms=false
        # Mount point of the host’s filesystem. Required to monitor the host
        # from within a container.
      # - --system.hostfs=/hostfs
    volumes:
      - type: bind
        source: ./filebeat/config/filebeat.yml
        target: /usr/share/filebeat/config/filebeat.yml
        read_only: true
      - type: bind
        source: /var/run/docker.sock
        target: /host_docker/docker.sock
        read_only: true
      - type: bind
        source: /var/lib/docker
        target: /host_docker/var/lib/docker
        read_only: true
    ulimits:
      memlock:
        soft: -1
        hard: -1
    network_mode: bridge
    deploy:
      mode: global

and config:

  providers:
    - type: docker
      templates:
        - condition:
            contains:
              docker.container.name: mot_api
          config:
            - type: container
              paths:
                - /var/lib/docker/containers/${data.docker.container.id}/*.log
              fields:
                app_name: stg_mot_api
        - condition:
            contains:
              docker.container.name: qmr_sync
          config:
            - type: container
              paths:
                - /var/lib/docker/containers/${data.docker.container.id}/*.log
              fields:
                app_name: stg_qmr_sync
        - condition:
            contains:
              docker.container.name: qmr_download
          config:
            - type: container
              paths:
                - /var/lib/docker/containers/${data.docker.container.id}/*.log
              fields:
                app_name: stg_qmr_download

output.logstash:
  hosts: ["localhost:5044"]

anyone have solution for this ?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.