Docker for Windows不工作 [英] Docker for Windows not working

查看:353
本文介绍了Docker for Windows不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我现在已经安装了Docker工具箱,我收到了所有错误:

I've installed Docker toolbox now and I get the error for everything:

Get http://127.0.0.1:2375/v1.20/version: dial tcp 127.0.0.1:2375: ConnectExtcp: No connection could be made because the target machine actively refused it..
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?

docker版本输出:

Client:
 Version:      1.8.1
 API version:  1.20
 Go version:   go1.4.2
 Git commit:   d12ea79
 Built:        Thu Aug 13 02:49:29 UTC 2015
 OS/Arch:      windows/amd64
Get http://127.0.0.1:2375/v1.20/version: dial tcp 127.0.0.1:2375: ConnectEx tcp: No connection could be made because the target machine actively refused it..
* Are you trying to connect to a TLS-enabled daemon without TLS?
* Is your docker daemon up and running?

但虚拟机正在VirtualBox下运行。我已经搜索无处不在,但找不到解决方案。

But the VM is running under VirtualBox. I have searched everywhere but can't find a solution.

UPDATE1 :我正在使用Windows 8.1,并尝试从Kinematic开始。

UPDATE1: I'm using Windows 8.1 and also tried to start through Kinematic also.

更新2:当我尝试Virtualbox Test Build 5.0.3或更高版本时,一切都像魅力一样。您可以在这里下载: https://www.virtualbox.org/wiki/Testbuilds

UPDATE2: Everything worked like charm when I tried Virtualbox Test Build 5.0.3 or later. You can download here: https://www.virtualbox.org/wiki/Testbuilds

推荐答案

只需运行:

"C:\Program Files\Docker Toolbox\docker-machine" ls

获取机器名称,然后运行:

get the machine name, and then run:

"C:\Program Files\Docker Toolbox\docker-machine" env <MACHINE_NAME_HERE> --shell=[cmd|powershell]

你应该得到这样的东西:

and you should get something like this:

"C:\Program Files\Docker Toolbox\docker-machine" env default --shell=cmd
set DOCKER_TLS_VERIFY=1
set DOCKER_HOST=tcp://192.X.X.X:2376
set DOCKER_CERT_PATH=C:\Users\X\.docker\machine\machines\default
set DOCKER_MACHINE_NAME=default
# Run this command to configure your shell:
# copy and paste the above values into your command prompt

我也收到错误打开C:\Users\X\.docker\machine\machines\default\server.pem:系统找不到指定的文件。
,并将其VirtualBox升级到版本5.0.3(从他们的 nightly builds

长版本

我有同样的问题d后,安装手册中的使用Windows Command Line Prompt(cmd.exe)中的Docker部分) / a>把我放在正确的方向

I got the same problem and after and the "Using Docker from Windows Command Line Prompt (cmd.exe)" section from the installation manual put me in the right direction

基本上,docker的工作方式是将docker命令传递给docker服务(在端口2375上运行)。当您从Windows主机运行Docker时,该服务实际上在由docker创建的Linux主机上运行(您可以通过打开virtualbox ui来查看它)。

Basically, the way docker works is that the "docker " commands are passed to a docker service (running on port 2375). As you are running the docker from windows host, the service actually runs on the linux host created by docker (you can see it by opening the virtualbox ui).

通常的流程如下:


  1. 创建默认机器

  2. 机器的启动器(kinamatic /Docker快速入门终端/ cmd)等待机器启动,获取其IP地址,并将linux ip:port设置为服务地址(而不是127.0.0.1:2375)在很少的enviremnt / powershell变量

  3. 从这一点上,所有的 docker ... 命令发送到linux主机和一切工作几乎是本地linux

  1. default machine is created
  2. the starter (kinamatic / "Docker Quickstart Terminal" / cmd) of the machine waits for the machine to boot, gets it's IP address and sets the linux ip:port as the service address (instead of 127.0.0.1:2375) in few enviremnt/powershell variables
  3. from this point all docker ... commands are send to the linux host and everything works almost as native linux

问题是机器设置有一些问题(我猜想新的虚拟框但我不确定,有时间挖掘它)。你可以看到,通过runnung ls 命令,并注意到(至少在我的情况下)机器的状态是超时,没有url,不像输出手册中显示。

The problem is that there is some issue with the machine setup (my guess the new virtual box but I am not sure and have the time to dig into it). You can see that by runnung the ls command and notice that (at least in my case) the state of the machine is "timeout" and there is no url, unlike the output shown in the manual.

这将导致环境值不被设置,并且 docker ... 命令失败。

This causes the enviorment values not to be set and the docker ... commands to fail.

除了运行该命令,您还可以启动 Docker Quickstart Terminal ,这样做同样的事情,但是sh shell

Apart from running the command, you can also start the Docker Quickstart Terminal that does the same thing but with sh shell

关于证书错误,我尝试使用以下方式从虚拟机中重新生成证书:

Regarding the certificate error, I tried to regenrate the certificates from within the virtual machine using:

/usr/local/bin/generate_cert --overwrite --host=default,127.0.0.1,10.0.2.15,192.168.99.100 --ca=/var/lib/boot2docker/tls/ca.pem --ca-key=/var/lib/boot2docker/tls/cakey.pem --cert=/var/lib/boot2docker/tls/server.pem --key=/var/lib/boot2docker/tls/serverkey.pem

当尝试将证书复制到主机时,我收到协议错误,其中提醒我一个旧的虚拟机共享文件夹错误,所以这可能不是Docker的问题,但是使用virtualbox - 我升级到最新的夜间版本(5.0.3-102224),重新生成默认映像,似乎解决了它。由于Windows 10尚未由docker和virtualbox正式​​支持,我不知道这是否与导致您获取证书错误的事情相同,在任何情况下都可以尝试从虚拟机复制证书(您有代码块中的路径)到您的本地用户目录(它映射到/ c / Users / X /在虚拟机中)

I got "protocol error"s when tried to copy the certificate to the host machine, which reminded me an old virtualbox shared folders bug, so this may not be a problem with docker but with virtualbox - I upgraded to the latest nightly version (5.0.3-102224), regenerated the default image and that seems to solve it. As windows 10 is not officially supported yet neither by docker nor by virtualbox, I am not sure if this is the same thing that causes you to get the certificate error, In any case can try to copy the certificates from the virtual machine (you have the paths in code block) to your local user directory (it is mapped to /c/Users/X/ in the virtual machine)

这篇关于Docker for Windows不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆