Windows docker: permission denied /var/run/docker.sock

你离开我真会死。 提交于 2021-02-18 11:30:10

问题


When I try to run filebeat with autodiscover I get the following error:

Exiting: error in autodiscover provider settings: 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.22/containers/json?limit=0: dial unix /var/run/docker.sock: connect: permission denied

I exposed the daemon on tcp://localhost:2375 from docker settings.

I checked that my user is member of "docker-users" group.

docker-compose.yml:

filebeat:
    image: store/elastic/filebeat:7.3.0
    volumes:
      - ./config/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
      - /var/lib/docker/containers/:/var/lib/docker/containers/:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro

回答1:


Adding user: root to docker-compose.yml fixes socket access:

filebeat:
    image: store/elastic/filebeat:7.3.0
    volumes:
      - ./config/filebeat.yml:/usr/share/filebeat/filebeat.yml:ro
      - /var/lib/docker/containers/:/var/lib/docker/containers/:ro
      - /var/run/docker.sock:/var/run/docker.sock:ro
    user: root


来源:https://stackoverflow.com/questions/57724705/windows-docker-permission-denied-var-run-docker-sock

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!