21

I have installed docker for Windows 10 (Anniversary) as per MSDN
I can execute docker.exe commands in an elevated powershell environment, but not in a regular powershell.

I have updated the docker configuration file to contain:

{
    "group": "Power Users"
}

And have obviously added the user to power users, the user is also in the administrators group.

Is there any way to execute docker commands such as docker search * without using run as administrator

Warning: failed to get default registry endpoint from daemon (error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/info: open //./pipe/docker_engine: Access is denied.). Using system default: https://index.docker.io/v1/ error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/images/search?limit=25&term=%2A: open //./pipe/docker_engine: Access is denied.

5
  • 1
    Have to ask - did you restart the service after changing the config file? Commented Oct 17, 2016 at 10:13
  • thanks for the reminder, in order to be certain I rebooted the laptop, same issue exactly. it might be a bug, perhaps the named pipe is not getting setup correctly according to the group permissions. Commented Oct 17, 2016 at 12:31
  • Where did you put the daemon.json config? It's supposed to be C:\ProgramData\Docker\config\daemon.json. Docker may not support a group name that requires quotes around it due to space. They recommend "docker", but I used "docker-users". Commented Feb 4, 2022 at 20:40
  • Take a look on this i solved the problem with that Commented Feb 27, 2023 at 11:38
  • See also: Running dockerd gives error "open //./pipe/docker_engine: Access is denied." (Windows Server 1709) Commented Oct 22, 2024 at 9:22

6 Answers 6

10

Although my user has Administrator privileges, I don't need to use an elevated PowerShell to run docker.

You can try making the connection via TCP. In Power Shell type:

$env:DOCKER_HOST="tcp://0.0.0.0:2375"
docker ps

Or

$env:DOCKER_HOST="tcp://localhost:2375"
docker ps

Since version 17.03.1-ce-win12 (12058) you must check Expose daemon on tcp://localhost:2375 without TLS if you use Docker for Windows and connecting via TCP

Regards

Sign up to request clarification or add additional context in comments.

4 Comments

There's a real possibility that I was just doing something wrong, but I tried this and it didn't make a difference for me. @Carlos did you install Docker For Windows or the dockerd.exe manually?
Hello, no I installed Docker for Windows. But I recall that in your question you aprobably are using Windows Container. In such case i recommend you try the @Jeff way. I have Docker for Windows but the stable one which doesn't support Windows Containers yet
i was torn between these two answers, but this one most directly addresses the issue. I imagine this is a bug, as what's available via TCP/IP should also be available via PIPE. After all, they are just transport mechanisms.
This really helped, but I also needed to swap by daemon to Windows Containers - worth checking which you need.
4

This is a sideways way of answering your question, but I think it will be what you're after in the long run....

As of 1.12.2 Beta 26 Docker For Windows allows you to switch between Windows and Linux containers. The install is an MSI so it appears to set up the correct permissions too. (And you don't have to go though all the manual steps to get Windows containers working!)

I'm using 1.12.2 Beta 28 on Win 10. I can switch between Linux and Windows; and run Docker commands with out running PS as admin. I've tested 'docker ps', 'docker info', and 'docker search *' so far..

Here's where I got my info (https://stefanscherer.github.io/run-linux-and-windows-containers-on-windows-10/)

Comments

3

I was facing this issue when I started the powershell/cmder without administrator. The issue got resolved when I started my powershell/cmder with run as administrator.

Comments

2

Note: The solution below (green tick answer) resolved my issue. Mentioning this so it can help others.

You should stop docker service and then run the dockerd command.

To stop docker:

  1. Search for "services" in start menu & open services.
  2. Select Docker Engine service and right click
  3. Select "Stop" option.

Image showing docker engine service in windows services

Now you can try running the dockerd command again.

Solution Reference:

The Docker service (running as a Windows service) is bound to the dockerd application (because dockerd is the docker daemon). If you stop the Docker service and then run the dockerd command from the sites listed in the question, it will work.

Url: Running dockerd gives error "open //./pipe/docker_engine: Access is denied." (Windows Server 1709)

Comments

0

I tried Carlos solution but it didn't work for me.

So I just had to open "lusrmgr.msc" (Windows) and add my user to the "docker-users" group as shown below. Then I restarted my computer and all worked fine!

More info on this issue: https://github.com/docker/for-win/issues/868.

Adding local user to docker-users group.

Comments

0

Fixed with this ps script, just give full permission to \.\pipe\docker_engine , logout and then log on back again.

$account="Domain\Username"
$npipe = "\\.\pipe\docker_engine"
$dInfo = New-Object "System.IO.DirectoryInfo" -ArgumentList $npipe
$dSec = $`dInfo`.GetAccessControl()
$fullControl =[System.Security.AccessControl.FileSystemRights]::FullControl
$allow =[System.Security.AccessControl.AccessControlType]::Allow
$rule = New-Object "System.Security.AccessControl.FileSystemAccessRule" -ArgumentList $account,$fullControl,$allow
$dSec.AddAccessRule($rule)
$dInfo.SetAccessControl($dSec)

Replace your domain and username , you can get this with : $env:USERDOMAIN + "" + $env:USERNAME in powershell.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.