Error //./pipe/docker_engine: Access is denied. In the default daemon configuration on Windows.

While executing VSTS\TFS docker task, you might get the following error.

error during connect: Post <url>: open //./pipe/docker_engine: Access is denied. In the default daemon configuration on Windows, the docker client must be run elevated to connect. This error may also indicate that the docker daemon is not running.

The error means that the VSTS agent which is executing the docker client does not have permission to write to the named pipe 'docker_engine'. 

When you install docker engine by default only the administrator group has the permission to write to the 'docker_engine' named pipe. If you configure VSTS agent service with the user account which is not the agent machine administrator, you will face this issue.

Solution 1:

Step 1. Add the user\group used to configure VSTS agent as an administrator.

Step 2. Restart the VSTS agent service.

Solution 2

Step 1: Create a new group. Say 'docker_engine'

Step 2: Add the user which is used to configure VSTS agent to this group.

Step 3: edit the docker daemon configuration json file to add  ("group": "docker_engine"). More info here.

Step 4: Restart the VSTS agent service.