docker-machine使用digitalocean驱动程序创建:ssh命令错误

时间:2017-06-30 21:06:57

标签: digital-ocean docker-machine

我正在Windows上使用docker工具。

create命令上周工作正常,我设法在Digital Ocean上创建了许多机器。然后我今天尝试了没有成功。我在不同的地区重复了同样的命令,我总是得到相同的结果:

λ docker-machine create -d digitalocean --digitalocean-access-token=MYTOKEN --digitalocean-region=ams2 vmname
Running pre-create checks...
Creating machine...
(fernu) Creating SSH key...
(fernu) Creating Digital Ocean droplet...
(fernu) Waiting for IP address to be assigned to the Droplet...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(systemd)...
Installing Docker...
Copying certs to the local machine directory...
Copying certs to the remote machine...
Setting Docker configuration on the remote daemon...
Error creating machine: Error running provisioning: ssh command error:
command : sudo systemctl -f start docker
err     : exit status 1
output  : Job for docker.service failed because the control process exited with error code. See "systemctl status docker.service" and "journalctl -xe" for details.

如果我执行建议的命令:

root@fernu:~# systemctl status docker.service
● docker.service - Docker Application Container Engine
   Loaded: loaded (/lib/systemd/system/docker.service; enabled; vendor preset: enabled)
  Drop-In: /etc/systemd/system/docker.service.d
           └─10-machine.conf
   Active: inactive (dead) (Result: exit-code) since Fri 2017-06-30 20:56:13 UTC; 8min ago
     Docs: https://docs.docker.com
  Process: 4943 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=digitalocean (code=exited, status=1/FAILURE)
 Main PID: 4943 (code=exited, status=1/FAILURE)

Jun 30 20:56:13 fernu systemd[1]: docker.service: Main process exited, code=exited, status=1/FAILURE
Jun 30 20:56:13 fernu systemd[1]: Failed to start Docker Application Container Engine.
Jun 30 20:56:13 fernu systemd[1]: docker.service: Unit entered failed state.
Jun 30 20:56:13 fernu systemd[1]: docker.service: Failed with result 'exit-code'.
Jun 30 20:56:13 fernu systemd[1]: docker.service: Service hold-off time over, scheduling restart.
Jun 30 20:56:13 fernu systemd[1]: Stopped Docker Application Container Engine.
Jun 30 20:56:13 fernu systemd[1]: docker.service: Start request repeated too quickly.
Jun 30 20:56:13 fernu systemd[1]: Failed to start Docker Application Container Engine.

任何帮助将不胜感激

更新

与ubuntu 14一起使用: --digitalocean-image=ubuntu-14-04-x64所以它就像默认图像的问题(ubuntu-16-04-x64)

1 个答案:

答案 0 :(得分:0)

这似乎打击了很多人。 TL; DR:docker-machine v0.12.0中有a bug,可以通过升级解决此问题。

登录DigitalOcean实例并运行journalctl -xe可提供更多信息:

-- Unit docker.service has begun starting up.
Jul 07 20:03:52 docker-sandbox docker[4930]: `docker daemon` is not supported on Linux. Please run `do
Jul 07 20:03:52 docker-sandbox systemd[1]: docker.service: Main process exited, code=exited, status=1/
Jul 07 20:03:52 docker-sandbox systemd[1]: Failed to start Docker Application Container Engine.
-- Subject: Unit docker.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel

这里的密钥是docker daemon is not supported on Linux. A bug在docker-machine的版本比较代码中导致在某些版本的某些版本上生成了一个不正确的systemd单元文件(位于/etc/systemd/system/docker.service.d/10-machine.conf) Ubuntu的。

制作了fix has been committed和新版本(v0.12.1)。

您可以在https://github.com/docker/machine/releases/tag/v0.12.1

获取最新版本