重启 docker Windows 10 命令行 [英] Restart docker Windows 10 command line
问题描述
我想弄清楚如何在命令行中重新启动 docker,以便我可以制作一个 bat 脚本来重新启动它并启动几个容器.
I am trying to figure out how to restart docker in the command line so that i can make a bat script to restart it and start up a few containers.
我使用管理员访问权限创建了一个 dos 提示并运行以下命令
I created a dos prompt using admin access and run the following
PS C:\Windows\system32> net stop com.docker.service
The Docker for Windows Service service is stopping.
A system error has occurred.
System error 1067 has occurred.
The process terminated unexpectedly.
The Docker for Windows Service service was stopped successfully.
PS C:\Windows\system32> net start com.docker.service
The Docker for Windows Service service is starting.
The Docker for Windows Service service was started successfully.
PS C:\Windows\system32> docker ps
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.25/containers/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 ma
y also indicate that the docker daemon is not running.
PS C:\Windows\system32>
注意:我可以使用 docker windows 应用重新启动它.但是我需要做这个命令行.
Note: i can restart it fine using the docker windows app. However I need to do this comandline.
任何想知道我为什么要重新启动 docker 的背景 Docker 在 win 10 后不会启动容器关机和开机..每次重新启动时,我都厌倦了这样做,所以希望创建一个我可以启动的 bat 文件.
Background for anyone wondering why i am restarting docker Docker won't start containers after win 10 shutdown and power up.. I am sick to death of doing this every time i reboot so was hoping to create a bat file i could just kick off.
推荐答案
这是 Docker for Windows Desktop 的更新版本(Docker Community Edition 2.0.0.3 2019-02-15)
This is with more recent versions of Docker for Windows Desktop (Docker Community Edition 2.0.0.3 2019-02-15)
net stop docker
net stop com.docker.service
taskkill /IM "dockerd.exe" /F
taskkill /IM "Docker for Windows.exe" /F
net start docker
net start com.docker.service
"c:\program files\docker\docker\Docker for Windows.exe"
这篇关于重启 docker Windows 10 命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!