Docker:尝试连接时发生错误 [英] Docker: An error occurred trying to connect
问题描述
在 Windows 上安装了 Docker,另外安装了 2 个,Oracle VM VirualBox 和 Kitematic.我在我的 Windows 10 PC 中禁用了 Hyper-V.现在的问题是我无法从 DockerHub 下载任何 Docker 镜像,甚至无法运行命令
Installed Docker on Windows with 2 additional installs, Oracle VM VirualBox and Kitematic. I've disabled Hyper-V in my Windows 10 PC. Now the problem is I can't download any Docker images from DockerHub, not even I can run the command as
Docker info
在两端显示以下错误.
尝试连接时发生错误:获取http://localhost:2375/v1.21/info:拨打tcp 127.0.0.1:2375:ConnectExtcp:由于目标机器主动,无法建立连接拒绝了.
An error occurred trying to connect: Get http://localhost:2375/v1.21/info: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it.
如果我在 Docker QuickStart Terminal 中运行它,它可以工作,但不能在 PowerShell 或 MSBuild 中工作.
If I run it in Docker QuickStart Terminal it works, but not working in PowerShell or in MSBuild.
推荐答案
如果您使用的是 windows 命令提示符而不是 Docker QuickStart Terminal,请参阅 official docs 您应该执行以下步骤(假设您的 docker 机器的名称为 default):
If you are using windows command prompt instead of Docker QuickStart Terminal see official docs you should make following steps (assuming your docker machine has the name default):
docker-machine start default
或者新建一个docker-machine ls
会显示你的机器正在运行docker-machine env --shell cmd default
你会看到类似
docker-machine start default
or create new onedocker-machine ls
will show you your machine runningdocker-machine env --shell cmd default
and you'll see something like
SET DOCKER_TLS_VERIFY=1
SET DOCKER_HOST=tcp://192.168.99.100:2376
SET DOCKER_CERT_PATH=C:UsersArseny.dockermachinemachinesdefault
SET DOCKER_MACHINE_NAME=default
REM Run this command to configure your shell:
REM FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO %i
FOR/f "tokens=*" %i IN ('docker-machine env --shell cmd default') DO %i
这篇关于Docker:尝试连接时发生错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!