【发布时间】:2017-04-26 03:05:37
【问题描述】:
好的,这很容易重现,而且非常令人沮丧。将非常感谢任何帮助或建议!我正在使用 Docker for Mac,在 OS X El Capitan (10.11.6) 上运行。要点是 Docker 似乎无法通过 Docker GCE 驱动程序与 Google Compute Engine (GCE) 一起使用(Docker 官方文档参考 here)。
1:在http://console.cloud.google.com/ 注册一个新的免费 GCP (Google Cloud) 帐户。也可以从这里下载并安装 Google Cloud SDK:https://cloud.google.com/sdk/。
2:创建一个新的 Google Cloud 项目。
3:进入谷歌云控制台中的“API Manager”,点击“Credentials”
4:点击“Create Credentials”并选择“Service Account Key”。选择“Compute Engine 默认服务帐户”,确保选择 JSON 作为输出类型,然后单击“创建”。将输出的 JSON 文件移动到您的用户根目录 (/Users/MYUSERNAME)。
5:将以下行添加到您的 .bash_profile 配置中:
export GOOGLE_APPLICATION_CREDENTIALS=/Users/MYUSERNAME/NAME_OF_CREDENTIALS_FILE.json。保存文件。
6:退出终端并打开一个新终端,以便设置环境变量。
7:运行gcloud config set project PROJECT_ID(其中 PROJECT_ID 是刚刚在 Google Cloud Console 中创建的项目的名称)。
8:运行gcloud auth login,这将打开一个浏览器选项卡,让您登录 Google 并授予权限。点击“允许”。
9:现在有趣的部分,根据 Docker documentation 运行以下命令(我添加了一个 --debug 标志):
docker-machine --debug create --driver google --google-project PROJECT_ID vm01
('vm01' 是这里的虚拟机名称,可以是你想要的任何名称。)
在非常冗长的输出结束时,我得到以下内容,并以最底部的错误消息结束:
(LOTS OF OTHER OUTPUT BEFORE THIS, NOT ABLE TO COPY-PASTE EVERYTHING DUE TO STACKOVERFLOW 30000 CHAR LIMIT)
(vm01) Calling .GetURL
(vm01) Calling .DriverName
Setting Docker configuration on the remote daemon...
(vm01) Calling .GetSSHHostname
(vm01) Calling .GetSSHPort
(vm01) Calling .GetSSHKeyPath
(vm01) Calling .GetSSHKeyPath
(vm01) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /Users/nathan/.docker/machine/machines/vm01/id_rsa (-rw-------)
&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker-user@104.198.166.134 -o IdentitiesOnly=yes -i /Users/nathan/.docker/machine/machines/vm01/id_rsa -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
printf %s "[Service]
ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=google
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
Environment=
[Install]
WantedBy=multi-user.target
" | sudo tee /etc/systemd/system/docker.service
SSH cmd err, output: <nil>: [Service]
ExecStart=/usr/bin/docker daemon -H tcp://0.0.0.0:2376 -H unix:///var/run/docker.sock --storage-driver aufs --tlsverify --tlscacert /etc/docker/ca.pem --tlscert /etc/docker/server.pem --tlskey /etc/docker/server-key.pem --label provider=google
MountFlags=slave
LimitNOFILE=1048576
LimitNPROC=1048576
LimitCORE=infinity
Environment=
[Install]
WantedBy=multi-user.target
(vm01) Calling .GetSSHHostname
(vm01) Calling .GetSSHPort
(vm01) Calling .GetSSHKeyPath
(vm01) Calling .GetSSHKeyPath
(vm01) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /Users/nathan/.docker/machine/machines/vm01/id_rsa (-rw-------)
&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker-user@104.198.166.134 -o IdentitiesOnly=yes -i /Users/nathan/.docker/machine/machines/vm01/id_rsa -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
sudo systemctl daemon-reload
SSH cmd err, output: <nil>:
(vm01) Calling .GetSSHHostname
(vm01) Calling .GetSSHPort
(vm01) Calling .GetSSHKeyPath
(vm01) Calling .GetSSHKeyPath
(vm01) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /Users/nathan/.docker/machine/machines/vm01/id_rsa (-rw-------)
&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker-user@104.198.166.134 -o IdentitiesOnly=yes -i /Users/nathan/.docker/machine/machines/vm01/id_rsa -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
sudo systemctl -f start docker
SSH cmd err, output: <nil>:
(vm01) Calling .GetSSHHostname
(vm01) Calling .GetSSHPort
(vm01) Calling .GetSSHKeyPath
(vm01) Calling .GetSSHKeyPath
(vm01) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /Users/nathan/.docker/machine/machines/vm01/id_rsa (-rw-------)
&{[-F /dev/null -o PasswordAuthentication=no -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o LogLevel=quiet -o ConnectionAttempts=3 -o ConnectTimeout=10 -o ControlMaster=no -o ControlPath=none docker-user@104.198.166.134 -o IdentitiesOnly=yes -i /Users/nathan/.docker/machine/machines/vm01/id_rsa -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
netstat -tln
SSH cmd err, output: <nil>: Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 10.0.3.1:53 0.0.0.0:* LISTEN
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN
tcp6 0 0 :::22 :::* LISTEN
Error creating machine: Error running provisioning: Unable to verify the Docker daemon is listening: Maximum number of retries (10) exceeded
notifying bugsnag: [Error creating machine: Error running provisioning: Unable to verify the Docker daemon is listening: Maximum number of retries (10) exceeded]
【问题讨论】:
标签: docker google-cloud-platform google-compute-engine docker-machine