Docker Machine to provision host on DigitalOcean fails with ssh command error

Issue:
I am trying to create a host on DigitalOcean using docker-machine. The host does get created, but the docker daemon fails to run on it.
I used the command
docker-machine create --driver digitalocean --digitalocean-access-token xxxx docker-sandbox, where xxxx is the token that I generated from DigitalOcean
This command fails with an ssh error. Logs are as shown below:

Creating CA: /root/.docker/machine/certs/ca.pem
Creating client certificate: /root/.docker/machine/certs/cert.pem
Running pre-create checks…
Creating machine…
(docker-sandbox) Creating SSH key…
(docker-sandbox) Creating Digital Ocean droplet…
(docker-sandbox) 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.

docker-machine ls

NAME ACTIVE DRIVER STATE URL SWARM DOCKER ERRORS
docker-sandbox - digitalocean Running tcp://104.131.172.210:2376 Unknown Unable to query docker version: Cannot connect to the docker engine endpoint

OS Version/build:

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION=“Ubuntu 16.04.2 LTS”
NAME=“Ubuntu”
VERSION=“16.04.2 LTS (Xenial Xerus)”
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME=“Ubuntu 16.04.2 LTS”
VERSION_ID=“16.04”
HOME_URL=“http://www.ubuntu.com/”
SUPPORT_URL=“http://help.ubuntu.com/”
BUG_REPORT_URL=“Bugs : Ubuntu”
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

docker-machine version:

docker-machine version 0.12.0, build 45c69ad

Steps to reproduce:

  1. Generate a personal access token from DigitalOcean
  2. Run the command docker-machine create --driver digitalocean --digitalocean-access-token xxxx docker-sandbox replacing xxxx with the personal access token you earlier generated
  3. The command fails with an error as described above.

P.S: I am a newbie. Please add descriptions as much as possible for the solution.

1 Like

I was able to reproduce this. Logging in to the DigitalOcean instance and running journalctl -xe provides more information:

-- 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

Turns out this is a bug already reported on GitHub and fixed in version 0.12.1

You can grab the latest release at: https://github.com/docker/machine/releases/tag/v0.12.1

1 Like