There are a lot of threads out there troubleshooting permissions errors with Docker Desktop in Windows client operating systems. However, if you run into the error "Access Denied" or "Docker daemon is not running" in Windows Server, how do you fix it when Docker Desktop is not installed?
The error
Generally, you may see this error if you have installed Docker on a Windows Server, using Microsoft's installation script as an administrator user (which is typical installation steps). Then you try to run Docker as a "normal" user that is not an administrator.
Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/Windows-Containers/Main/helpful_tools/Install-DockerCE/install-docker-ce.ps1" -o install-docker-ce.ps1
Then, run this command:
.\install-docker-ce.ps1
What does the error look like when you run Docker as a non-admin user?
The solution
The solution involves:
1) Create a new local group called docker-users and add users to that group
2) Create a special file called daemon.json in the C:\ProgramData\docker\configย directory
3) Restart the Docker engine
4) Test using your non-admin user
ย
1) Create a new local group called docker-users and add users to that group
Begin by creating a new local group calledย docker-users
2) Create a special file called daemon.json in the C:\ProgramData\docker\configย directory
Add the following contents to the file:
{ "group": "docker-users" }
3) Restart the Docker engine
Login as an administrator. Navigate to services.msc, find theย Docker Engine, right-click, andย Restart.
4) Test using your non-admin user
Now we can log in as the non-admin user. Launch PowerShell or command prompt without admin privileges and we can now successfully run Docker commands.