用boot2docker 执行命令时总是报这个错误?有人知道是什么问题吗?
伊谢尔伦
伊谢尔伦 2017-04-22 08:56:08
0
1
597

$ docker images
Get http://127.0.0.1:2375/v1.19/images/json: 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?

伊谢尔伦
伊谢尔伦

小伙看你根骨奇佳,潜力无限,来学PHP伐。

全部回复(1)
黄舟

boot2docker start 之后需要设置下面三个环境变量:DOCKER_HOST, DOCKER_CERT_PATH, DOCKER_TLS_VERIFY

如果在 windows 下 boot2docker 启动成功之后会有下面的提示:

To connect the Docker client to the Docker daemon, please set:
If you are running inside Windows Command Prompt (cmd.exe), copy and paste the
following commands to your terminal to set the environment variables:
    set DOCKER_HOST=tcp://192.168.59.103:2376
    set DOCKER_CERT_PATH=C:\Users${user}\.boot2docker\certs\boot2docker-vm
    set DOCKER_TLS_VERIFY=1

If you are running inside PowerShell, copy or paste the following commands
to your shell or run "boot2docker shellinit | Invoke-Expression" to set the
environment variables:
    $Env:DOCKER_HOST = "tcp://192.168.59.103:2376"
    $Env:DOCKER_CERT_PATH = "C:\Users${user}\.boot2docker\certs\boot2docker-vm"
    $Env:DOCKER_TLS_VERIFY = "1"

将上面提示的那三个环境变量复制执行一遍就可以,例如在 windows 的 cmd 中执行:

set DOCKER_HOST=tcp://192.168.59.103:2376
set DOCKER_CERT_PATH=C:\Users${user}\.boot2docker\certs\boot2docker-vm
set DOCKER_TLS_VERIFY=1
热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板