gpt4 book ai didi

docker - 在Hyper-V上手动设置默认docker-machine

转载 作者:行者123 更新时间:2023-12-02 19:30:20 25 4
gpt4 key购买 nike

有时我在Docker上遇到Windows时遇到此错误。

我四处搜寻,找出原因。

结果是因为没有docker-machine默认值。

$docker ps
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.38/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 may also indicate that the docker daemon is not running.

我的操作系统是Windows 10,因此使用Hyper-V。

所以我这样试着
docker-machine create --driver hyperv default

但是它显示了这样的错误。
Error with pre-create check: "no External vswitch found. A valid vswitch must be available for this command to run. Check https://docs.docker.com/machine/drivers/hyper-v/"

我真的经常迷恋这个错误。

我该如何解决?

我用 DockerNAT选项指示了 hyperv-virtual-switch
docker-machine create --driver hyperv --hyperv-virtual-switch DockerNAT default
它看起来很进步。
Running pre-create checks...
(default) Image cache directory does not exist, creating it at C:\Users\whitebear\.docker\machine\cache...
(default) No default Boot2Docker ISO found locally, downloading the latest release...
(default) Latest release for github.com/boot2docker/boot2docker is v18.06.0-ce
(default) Downloading C:\Users\whitebear\.docker\machine\cache\boot2docker.iso from https://github.com/boot2docker/boot2docker/releases/download/v18.06.0-ce/boot2docker.iso...
(default) 0%....10%....20%....30%....40%....50%....60%....70%....80%....90%....100%
Creating machine...
(default) Copying C:\Users\whitebear\.docker\machine\cache\boot2docker.iso to C:\Users\whitebear\.docker\machine\machines\default\boot2docker.iso...
(default) Creating SSH key...
(default) Creating VM...
(default) Using switch "DockerNAT"
(default) Creating VHD
(default) Starting VM...
(default) Waiting for host to start...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with boot2docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Checking connection to Docker...
Docker is up and running!

最后,docker-machine工作。
PS C:\Windows\system32> docker-machine ls
NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
default - hyperv Running tcp://192.168.1.118:2376 v18.06.0-ce

但是 docker ps尚不起作用。
PS C:\Windows\system32> docker ps
error during connect: Get http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.38/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 may also indicate that the docker daemon is not running.

最佳答案

您可以手动创建一个外部vswitch,然后在docker-machine create ...期间选择它。有关类似问题,请参见https://stackoverflow.com/a/51333650/372019

https://rominirani.com/docker-machine-windows-10-hyper-v-troubleshooting-tips-367c1ea73c24上的博客提供了有关do​​cker-machine其他可能问题的更多详细信息。

关于docker - 在Hyper-V上手动设置默认docker-machine,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51922029/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com