【问题标题】:Docker says: No connection could be made because the target machine actively refused itDocker 说:无法连接,因为目标机器主动拒绝
【发布时间】:2016-05-15 03:19:33
【问题描述】:

我每天都在使用 docker,但今天发生了一个问题,没有进行任何更改。我打开 docker 终端并尝试启动我的一个容器。但是它给出了这个错误:“无法建立连接,因为目标机器主动拒绝它”我使用的是Windows 10。

                        ##         .
                  ## ## ##        ==
               ## ## ## ## ##    ===
           /"""""""""""""""""\___/ ===
      ~~~ {~~ ~~~~ ~~~ ~~~~ ~~~ ~ /  ===- ~~~
           \______ o           __/
             \    \         __/
              \____\_______/

docker is configured to use the default machine with IP 192.168.99.100
For help getting started, check out the docs at https://docs.docker.com


admin@samsung MINGW64 ~
$ docker ps
An error occurred trying to connect: Get http://127.0.0.1:2375/v1.22/containers/json: dial tcp 127.0.0.1:2375: connectex: No connection could be made because the target machine actively refused it.

admin@samsung MINGW64 ~
$ docker version
Client:
 Version:      1.10.2
 API version:  1.22
 Go version:   go1.5.3
 Git commit:   c3959b1
 Built:        Mon Feb 22 22:37:33 2016
 OS/Arch:      windows/amd64
An error occurred trying to connect: Get http://127.0.0.1:2375/v1.22/version: dial tcp 127.0.0.1:2375: connectex: No connection could be made because the target machine actively refused it.

【问题讨论】:

    标签: linux docker virtualbox docker-machine


    【解决方案1】:
    1. 右键单击您的电脑
    2. 属性
    3. 高级系统设置
    4. 环境变量
    5. 添加新变量:DOCKER_HOST
      值:tcp://127.0.0.1:2375
    6. 运行 Docker 桌面
    7. 右下角,右键单击 Docker-Desktop
    8. 设置
    9. 启用以下选项:“在 tcp://localhost:2375 没有 TLS"

    【讨论】:

    • 是的!这是唯一对我有用的解决方案。有或没有“暴露守护进程”——它只是我在 Windows 端需要的环境变量(已经在 WSL 下设置)。
    • 很棒的解决方案。对我来说,“暴露守护进程...”复选框必须打勾,否则$ docker container list -a输出error during connect: Get "http://127.0.0.1:2375/v1.24/containers/json?all=1": dial tcp 127.0.0.1:2375: connectex: No connection could be made because the target machine actively refused it.
    【解决方案2】:

    我已通过转到Oracle VM VirtualBox Manager(可以在开始菜单中搜索)、停止虚拟机(在我的情况下为default)然后再次运行Docker Quickstart Terminal 来解决此问题。

    另外,请参考this的回答。

    【讨论】:

      【解决方案3】:

      “主动拒绝”表示当您尝试连接时主机发送了重置而不是确认。因此,这在您的代码中不是问题。有防火墙阻止了连接,或者托管服务的进程没有在该端口上侦听。这可能是因为它根本没有运行,或者因为它正在侦听不同的端口。

      启动托管服务的进程后,尝试netstat -anb(需要管理员权限)以验证它是否正在运行并在预期的端口上侦听。

      【讨论】:

        【解决方案4】:

        我也遇到了同样的问题,甚至尝试停止然后重新启动默认机器。

        解决方案: 最后,我重新启动了系统,然后打开了新的 Docker 快速启动终端。之后我再次运行“docker run hello-world”,然后它连接起来并从 library/hello-world 中拉出 hello-world。

        【讨论】:

          【解决方案5】:

          对我来说,这是连接到 VPN 造成的。

          断开与 VPN 的连接以允许连接到本地 VirtualBox / Docker 实例。

          【讨论】:

            猜你喜欢
            • 2014-05-09
            • 2017-09-30
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2011-08-24
            • 2021-11-26
            相关资源
            最近更新 更多