无法从码头组合连接到码头 [英] Can't connect to docker from docker-compose

查看:472
本文介绍了无法从码头组合连接到码头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Mac OS 10.8.5上安装了docker-machine 0.1.0和docker-compose 1.1.0。
Docker-machine正常运行,能够通过docker-machine ssh连接。

  $ docker-machine ls 
名称活动驱动器状态URL SWARM
dev * virtualbox运行tcp://192.168.99.100: 2376

但是无法从docker-compose连接。

  $ docker-compose up 
无法通过http + unix连接到Docker守护程序://var/run/docker.sock - 是否正在运行?

如果它位于非标准位置,请使用DOCKER_HOST环境变量指定URL。

我的Dockerfile和docker-compose.yml在这里。



Dockerfile

  FROM centos:centos7 
DOCKER_HOST tcp://192.168.99.100:2376

docker-compose.yml

  web:
build:。

为什么不能连接?任何想法?

解决方案

Docker机器正在运行。但是您需要导出一些环境才能连接到Docker机器。默认情况下, docker CLI客户端正尝试使用 http + unix://var/run/docker.sock (如错误信息所示)



使用 eval $(docker-machine env dev)导出正确的环境变量然后再试一次。您也可以运行 docker-machine env dev 来查看它将导出的环境变量。请注意,其中一个是 DOCKER_HOST ,正如错误信息建议您可能需要设置的。


I installed docker-machine 0.1.0 and docker-compose 1.1.0 on Mac OS 10.8.5.
Docker-machine is running normally and able to connect by docker-machine ssh.

$ docker-machine ls
NAME   ACTIVE   DRIVER       STATE     URL                         SWARM
dev    *        virtualbox   Running   tcp://192.168.99.100:2376   

However can't connect from docker-compose.

$ docker-compose up
Couldn't connect to Docker daemon at http+unix://var/run/docker.sock - is it running?

If it's at a non-standard location, specify the URL with the DOCKER_HOST environment variable.

My Dockerfile and docker-compose.yml is here.

Dockerfile

FROM centos:centos7
DOCKER_HOST tcp://192.168.99.100:2376

docker-compose.yml

web:
  build: .

Why can't connect? Any ideas?

解决方案

The Docker machine is running. But you need to export some environment to connect to the Docker machine. By default, the docker CLI client is trying to communicate to the daemon using http+unix://var/run/docker.sock (as shown in the error message).

Export the correct environment variables using eval $(docker-machine env dev) and then try again. You can also just run docker-machine env dev to see the environment variables it will export. Notice that one of them is DOCKER_HOST, just as the error message suggests you may need to set.

这篇关于无法从码头组合连接到码头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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