【问题标题】:DockerDaemonConnectionError when setting Google Cloud Managed VM in Ubuntu在 Ubuntu 中设置 Google Cloud Managed VM 时出现 Docker 守护程序连接错误
【发布时间】:2014-11-10 11:23:51
【问题描述】:

我正在尝试根据本手册在 Ubuntu 中安装 Google Cloud Managed VM:[1][2]

我已经按照Docker installation guide 安装了 Docker。

运行 Docker:sudo docker -H tcp://127.0.0.1:2376 -d

我已经根据HTTPS Docker guide 创建了证书密钥。

我的环境变量:

  • DOCKER_HOST=tcp://:2376
  • DOCKER_TLS_VERIFY=1
  • DOCKER_CERT_PATH=/home/eyalev/ca

当我运行gcloud preview app setup-managed-vms

我收到一个错误:

https://gist.github.com/eyalev/aab86463bc63f4319d5c

Traceback (most recent call last):
File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py",
 line 153, in <module> main()   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/gcloud/gcloud.py",
 line 149, in main _cli.Execute()   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/calliope/cli.py",
 line 381, in Execute post_run_hooks=self.__post_run_hooks, kwargs=kwargs)   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/calliope/frontend.py",
 line 274, in _Execute pre_run_hooks=pre_run_hooks, post_run_hooks=post_run_hooks)   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/calliope/backend.py",
 line 887, in Run result = command_instance.Run(args)   File "/home/eyalev/Software/google-cloud-sdk/lib/googlecloudsdk/appengine/app_commands/setup_managed_vms.py",
 line 37, in Run setup_registry.SetupRegistry()   File "/home/eyalev/Software/google-cloud-sdk/./lib/googlecloudsdk/appengine/lib/images/setup_registry.py",
 line 32, in SetupRegistry timeout=config.DOCKER_D_REQUEST_TIMEOUT)   File "/home/eyalev/Software/google-cloud-sdk/platform/google_appengine/google/appengine/tools/docker/containers.py",
 line 663, in NewDockerClient 'Couldn\'t connect to the docker daemon using the specified ' google.appengine.tools.docker.containers.DockerDaemonConnectionError:

Couldn't connect to the docker daemon using the specified environment
variables. Please check the environment variables DOCKER_HOST,
DOCKER_CERT_PATH and DOCKER_TLS_VERIFY are set correctly. If you are
using boot2docker, make sure you have run "$(boot2docker shellinit)"

我有什么遗漏吗?

【问题讨论】:

    标签: python google-compute-engine google-cloud-platform


    【解决方案1】:

    我终于让gcloud preview app setup-managed-vms 在 ubuntu 上工作了。这是我必须做的:

    1. 获取 docker 1.3.0,而不是 1.3.1。 sudo apt-get install docker.io 在我的机器上安装了旧版本的 docker,所以我必须先删除它。但是curl -sSL https://get.docker.com/ubuntu/ | sudo sh 安装了 1.3.1 版,它也不起作用。我在https://get.docker.com/ubuntu/ 重播了脚本中的每一行,但我不得不将最后一行apt-get install -y lxc-docker 更改为apt-get install -y lxc-docker-1.3.0 官方文档提到应用引擎不适用于boot2docker 1.3.1,但我认为他们的意思是不适用于 docker 1.3.1。

    2. 我无法让 127.0.0.1 作为我的主机名。创建 ca 和服务器证书时,我必须使用 localhost

    3. 我必须导出DOCKER_HOST=tcp://localhost:2376(注意使用本地主机)以及DOCKER_TLS_VERIFY=1DOCKER_CERT_PATH=&lt;path&gt;

    4. 我将 /etc/default/docker 中的 DOCKER_OPTS 设置为 "--tlsverify --tlscacert=&lt;path&gt;/ca.pem --tlscert=&lt;path&gt;/server-cert.pem --tlskey=&lt;path&gt;/server-key.pem -H=0.0.0.0:2376"

    gcloud preview app setup-managed-vms 现在可以工作了,但我的 go 应用程序还没有得到gcloud preview app run 工作。

    【讨论】:

    • stackoverflow.com/questions/26823017 提到 Docker 1.3.2 应该解决 Docker 1.3.1 的问题
    • 您是否必须对权限进行任何操作?我必须使用 sudo 运行我的所有 cli 命令,我希望 gcloud 客户端也可能在这方面遇到问题。
    【解决方案2】:

    不确定这是否会有所帮助,但您可以尝试使用更明确的 DOCKER_HOST:

    DOCKER_HOST=tcp://localhost:2376
    

    【讨论】:

      【解决方案3】:

      我从unstable (Debian) 安装了 Docker 1.3.2,添加了

      DOCKER_OPTS="-d -H fd:// -H tcp://localhost:2375"
      

      /etc/default/docker,并设置

      DOCKER_HOST=tcp://localhost:2375
      

      让它工作。

      此站点包含如何为 CoreOS (systemd) 配置默认 Docker 设置的信息 https://coreos.com/docs/launching-containers/building/customizing-docker/

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2018-11-07
        • 2015-03-27
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2023-03-23
        • 1970-01-01
        相关资源
        最近更新 更多