How do we start the daemon?

2020-08-12 04:42发布

问题:

Running docker info from an elevated PowerShell prompt shows this error:

error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.27/info: 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. (Emphasis added)

How do we run the Docker daemon from the command line? If that is not possible, how do we run it without restarting Windows? If that is not possible, how do we start it at all?

Environment info

C:\> docker --version          
Docker version 17.03.1-ce, build c6d412e      

C:\> docker-compose --version  
docker-compose version 1.11.2, build f963d76f                                          

C:\> docker-machine --version  
docker-machine.exe version 0.10.0, build 76ed2a6                                       

What we have tried

Running docker daemon. It responds as follows:

Command "daemon" is deprecated, and will be removed in Docker 1.16. Please run dockerd directly. exec: "dockerd": executable file not found in %PATH%

Enabling Hyper-V and restarting the computer.

回答1:

If you're using Docker for Windows, Then simply start the desktop app installed in C:\Program Files\Docker\Docker\Docker Desktop.exe

You can also stop Docker for Windows and run just the Docker daemon dockerd.exe. That'll only let you run Docker Windows Containers. dockerd.exe is in the program files directory.



回答2:

Docker daemon on Windows Server run as windows service. This Docker service may not be running on your machine. Follow below steps

  1. Start->Run-> services.msc

  2. Search for service named "Docker"

  3. Start service.



回答3:

Not sure if this applies to your error condition, but I encountered same error while using Docker on Windows 10 while at work. The solution was to turn off a VPN. Then things were ok.

More details in an answer I posted here



回答4:

If you have installed docker on Windows 10 Pro with Hyper-V enabled and still you are not able to run Docker on Windows 10, then as the error suggests that your docker daemon is not started. Follow following steps it helped me to start docker successfully

  1. Use command on CMD(Admin mode) docker-machine restart default then you will get msg like "open C:\User{User_name}.docker\machine\machines\default\config.json: The system cannot find the file specified."
    Go to the docker icon which will be on your windows tray(Right corner of the desktop). Then Right click on the docker icon -> setting-> Reset -> Restart Docker It will take few moments then you will see the message "Docker is running with the green indicator".
    Note- If you have already had running Docker containers running on your system then don't follow these steps. You may lose the exiting containers.


回答5:

I had the same issue in windows 7. I found my issue was getting the VM working in virtual box.

Copy the "Boot2Docker.iso" file from "C:\Program Files\Docker Toolbox" 
into "C:\Users\<user name>\.docker\machine\cache"

Then I could run the start.sh in cygwin or Gitbash.

Note: I had to restart any cmd's for the docker to see the VM.