Docker Community Forums

Share and learn in the Docker community.

VictoriaMetrics vmagent skipping dockerswarm_sd_config targets for job_name "dockerswarm" because of error

I am getting the error “VictoriaMetrics/lib/promscrape/config.go:635 skipping dockerswarm_sd_config targets for job_name “dockerswarm” because of error: cannot query dockerswarm api for tasks: cannot fetch “http:///tasks”: dial unix /var/run/docker.sock: connect: no such file or directory” when trying to start vmagent container using these files:

docker-compose.yml :

version: ‘3.7’
services:
vmagent:
container_name: vmagent
image: victoriametrics/vmagent
ports:
- 8429:8429
volumes:
- vmagentdata:/vmagentdata
- ./prometheus.yml:/etc/prometheus/prometheus.yml
command:
- ‘–promscrape.config=/etc/prometheus/prometheus.yml’
- ‘–remoteWrite.url=http://localhost:8428/api/v1/write’
- “–promscrape.consulSDCheckInterval=60s”
networks:
- back-tier
restart: always
volumes:
vmagentdata: {}
networks:
back-tier:

prometheus.yml :

scrape_configs:

  • job_name: ‘dockerswarm’
    dockerswarm_sd_configs:
    • host: unix:///var/run/docker.sock
      role: tasks
      relabel_configs:

    • source_labels: [__meta_dockerswarm_task_desired_state]
      regex: running
      action: keep

    • source_labels: [__meta_dockerswarm_service_label_prometheus_job]
      regex: .+
      action: keep

    • regex: _meta_dockerswarm_service_label_prometheus(.+)
      action: labelmap
      replacement: $1

Аnd command :

docker stack deploy -c docker-compose.yml vimetr

Any thoughts?

At the same time and conditions command

docker -H unix:///var/run/docker.sock ps

works well.