Got permission denied while trying to connect to the Docker daemon socket

Viewed 1412

I'm trying to run a simple build on teamcity with docker on windows and use powershell for my commands. On teamcity I'm logged in as a super user and this build uses the command line to show the docker version. When I run this build I get this error message:

[15:30:55]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.40/version: dial unix /var/run/docker.sock: connect: permission denied
[15:30:55]Process exited with code 1

I'm using the following docker-compose file:

version: '3.1'

services:
  teamcity:
    image: jetbrains/teamcity-server
    volumes:
      - teamcity-server-datadir:/data/teamcity_server/datadir
      - teamcity-server-logs:/opt/teamcity/logs
    ports:
      - 8111:8111
  teamcity-agent:
    image: jetbrains/teamcity-agent
    environment:
      SERVER_URL: http://teamcity:8111
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
volumes:
  teamcity-server-datadir:
  teamcity-server-logs:

I have tried the workaround to add a group user with the sudo commands, but sudo is not recognized. Any help is welcome!

0 Answers
Related