Auto Start Docker on Windows reboot - windows

I created a task to autostart docker on windows server using TaskScheduler
referred to https://stackoverflow.com/a/59467740/12768108
As admin created a local "task-executor" user and added it to the administrator group.
As admin added the same user to the docker-users group
Now after logging into the system using another user account(already in the docker users group), I run the task manually from the task scheduler the docker services started with daemon mode and I am able to run all docker commands like "docker ps".
But when restarting the machine it only started two services of docker ie "docker desktop" and "docker desktop backend" and not others, also when tried to run docker ps gives below error
error during connect: This error may indicate that the docker daemon is not running.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json": open //./pipe/docker_engine: The system cannot find the file specified.
I have also tried https://github.com/tfenster/dockeraccesshelper but this helps me achieve only point 1 of the description.
Can someone please let me know what i am missing here ?

Related

Docker container as Windows service start before login

I have created a container via Docker Desktop on a Windows PC and would now like to start this container like a service or daemon during system startup. If successful, the container would be accessible from its own network via 192.168.178.35:80 without a user having to log in and start Docker.
This is really not my favorite topic but I tried to learn about Windows task scheduling.
As you can see here I wrote a short powershell script that starts Docker Desktop.exe and then the container.
start "C:\Program Files\Docker\Docker\Docker Desktop.exe"
sleep 10
docker start 9df2014cdb06
exit
I assigned the script to the SYSTEM user in the task scheduler. (see screenshot 1)
Unfortunately, 192.168.178.35:80 cannot be reached when the system is booted. When I log in, I see that various Docker background processes in Task manager. (See screenshot 2).
However, Docker is no longer accessible in Powershell. (See error message)
PS C:\WINDOWS\system32> docker ps
error during connect: In the default daemon configuration on Windows, the docker client must be
run with elevated privileges to connect.: Get "http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.24/containers/json":
open //./pipe/docker_engine: The system cannot find the file specified.
And starting it from the desktop icon does not succeed either. Instead, the message appears that Docker is already running.
But my container is not running.
How do I get my container running and accessible on Windows after system startup and before user login?

Can't start Docker Desktop due to Windows group policy

I've updated Docker Desktop from 4.6.1 to 4.11.1, but after that I can't start Docker Desktop nor docker service. I looked in the logs and found this message:
[2022-08-12T19:27:53.379639400Z][com.docker.backend.exe][F] fork/exec C:\WINDOWS\System32\WindowsPowerShell\v1.0\powershell.exe: This program is blocked by group policy. For more information, contact your system administrator.
I see the error is provoked by a policy that the company where I work at has on every computer and it's something I can't change, so my question is:
Is there any way to configure Docker to start using CMD instead of Powershell? Or do I have to reinstall previous version and avoid updating?

Permissions to run docker container on self-hosted windows azure devops agent

In an azure devops build pipeline running on a self-hosted windows agent, I am trying to execute a tool that run a docker container.
Unfortunately I get this error :
Failed to start: failed to create container: Error response from daemon: CreateFile c:\Users\BUILDAGENT\.aerokube\selenoid: Access is denied.
The build agent is configured with its own windows local user "BUILDAGENT", so he has permissions on the C:\Users\BUILDAGENT\ folder
Looking at the process manager, I see that except com.docker.service, the others docker processes are running with the user that launched the Docker Desktop (my coworker).
If I restart windows and relaunch docker myself, the settings selected by my coworker ("Disk Image Location" for instance), are not restored...
Is there a way to make docker run as a daemon on startup with a specific user (service or system user, but not mine or my coworker) ?
Once this is done I guess I just have to give permissions for that specific user on the C:\Users\BUILDAGENT\ folder to solve my issue, right ?
Update :
I added my BUILDAGENT user in docker-users group, and it solves the permission issue, but I still would like to run docker as a service, instead of login as my local user to launch it with its GUI...
but I still would like to run docker as a service, instead of login as my local user to launch it with its GUI
You could try to create a task scheduler to run docker with that specific user when your PC starts.
Please check this thread How to create an automated task using Task Scheduler on Windows 10 for some more details.
In this case, docker will start automatically every time you start your computer.

How to remove Docker.Service from startup

Every time i start my computer, the Docker.Service service is loaded into my memory.
System: Windows 10 Pro 1903, Docker 2.0.0.3
I tried to avoid this by:
Disabling docker in the task manager startup tab
Disabling it in the Docker for Desktop itself
Removing all docker related entries from the Run / RunService folders in the registry
Still, Docker.Service appears in my task manager after restarting my computer.
How can i prevent my computer to load Docker.Service on startup?
For me this was annoying too and i have solved this by simply unticking the check box Start Docker Desktop when you login. This setting can be found if you right click on the whale in the tray and then go to settings > general.
If i now want to use Docker i have to manually start it.
You can also go to windows services WIN + R > services.msc and there you can manipulate the Docker Desktop Service. If it is configured to start automatically you can set this to manual in the properties of the service.

failing to start docker engine open //./pipe/docker_engine

I'm receiving the following error in docker on windows 10 laptop.
I've try to reinstall and restart but nothing helps.
The docker service is running OK but what i understand that i have a problem with the docker daemon (from what i read)
The whole issue started when i run the 2 commands:
net stop com.docker.service
net start com.docker.service
from there on i keep getting the error below and cannot solve it.
C:\Users\xxxx>docker images error during connect: Get
http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.30/images/json: open
//./pipe/docker_engine: The system cannot find the file specified. 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.
anyone succeed to solve it?
docker client must be run elevated to connect
This indicates that you do not have enough permissions. Try starting the terminal as administrator.
I run Docker remotely as a non admin user.
For this the user running docker should have full permission to location where Docker is installed.
User should be part of docker_users group
docker daemon runs on port 2375 by default. Try to whitelist this port. Allow incoming connections to 2375 in Windows Firewall settings
Restart your docker daemon and Docker service.
Restart the running Docker instance[Docker for Windows] if required. You do not have to reinstall.

Resources