docker / machine

Machine management for a container-centric world
https://docs.docker.com/machine/
Apache License 2.0
6.63k stars 1.97k forks source link

Generic driver fails to create machine if Docker is installed but stopped #2978

Open TamsynUlthara opened 8 years ago

TamsynUlthara commented 8 years ago

Following my experience with #2976, I stumbled upon another issue: if Docker is installed, but currently stopped, docker-machine create fails.

The following logs have machine names, hostnames, and IPs changed to protect the guilty. ;-)

I ran the following command on a machine with Docker installed, but stopped (via systemd):

$ docker-machine -D create --driver generic --generic-ip-address mymachine.example.com --engine-storage-driver overlay mymachine
Docker Machine Version:  0.6.0-rc2, build f35bc0b
Found binary path at /usr/bin/docker-machine
Launching plugin server for driver generic
Plugin server listening at address 127.0.0.1:44071
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(flag-lookup) Calling .GetMachineName
(flag-lookup) Calling .DriverName
(flag-lookup) Calling .GetCreateFlags
Found binary path at /usr/bin/docker-machine
Launching plugin server for driver generic
Plugin server listening at address 127.0.0.1:38130
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(mymachine) Calling .GetMachineName
(mymachine) Calling .DriverName
(mymachine) Calling .GetCreateFlags
(mymachine) Calling .SetConfigFromFlags
Creating CA: /home/tomxtobin/.docker/machine/certs/ca.pem
Creating client certificate: /home/tomxtobin/.docker/machine/certs/cert.pem
Running pre-create checks...
(mymachine) Calling .PreCreateCheck
(mymachine) Calling .GetConfigRaw
Creating machine...
(mymachine) Calling .Create
(mymachine) Calling .GetConfigRaw
(mymachine) No SSH key specified. Connecting to this machine now and in the future will require the ssh agent to contain the appropriate key.
(mymachine) DBG | IP: mymachine.example.com
(mymachine) Calling .DriverName
(mymachine) Calling .DriverName
Waiting for machine to be running, this may take a few minutes...
(mymachine) Calling .GetState
Machine is running, waiting for SSH to be available...
Getting to WaitForSSH function...
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
exit 0
SSH cmd err, output: <nil>: 
Detecting operating system of created instance...
Detecting the provisioner...
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
cat /etc/os-release
SSH cmd err, output: <nil>: NAME="Ubuntu"
VERSION="15.10 (Wily Werewolf)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 15.10"
VERSION_ID="15.10"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"

found compatible host: ubuntu
Provisioning with ubuntu(systemd)...
setting hostname
(mymachine) Calling .GetMachineName
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
sudo hostname mymachine && echo "mymachine" | sudo tee /etc/hostname
SSH cmd err, output: <nil>: mymachine

(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:

        if ! grep -xq .*mymachine /etc/hosts; then
            if grep -xq 127.0.1.1.* /etc/hosts; then 
                sudo sed -i 's/^127.0.1.1.*/127.0.1.1 mymachine/g' /etc/hosts; 
            else 
                echo '127.0.1.1 mymachine' | sudo tee -a /etc/hosts; 
            fi
        fi
SSH cmd err, output: <nil>: 
installing base packages
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
sudo apt-get update
SSH cmd err, output: <nil>: Hit http://archive.ubuntu.com wily InRelease
Get:1 http://archive.ubuntu.com wily-updates InRelease [64.4 kB]
Hit http://archive.ubuntu.com wily-backports InRelease
Hit http://archive.ubuntu.com wily/main Sources
Hit http://archive.ubuntu.com wily/restricted Sources
Hit http://archive.ubuntu.com wily/universe Sources
Hit http://archive.ubuntu.com wily/multiverse Sources
Hit http://archive.ubuntu.com wily/main amd64 Packages
Hit http://archive.ubuntu.com wily/restricted amd64 Packages
Hit http://archive.ubuntu.com wily/universe amd64 Packages
Hit http://archive.ubuntu.com wily/multiverse amd64 Packages
Hit http://archive.ubuntu.com wily/main i386 Packages
Hit http://archive.ubuntu.com wily/restricted i386 Packages
Get:2 http://security.ubuntu.com wily-security InRelease [64.4 kB]
Hit http://archive.ubuntu.com wily/universe i386 Packages
Hit http://archive.ubuntu.com wily/multiverse i386 Packages
Hit http://archive.ubuntu.com wily/main Translation-en
Hit http://archive.ubuntu.com wily/multiverse Translation-en
Hit http://archive.ubuntu.com wily/restricted Translation-en
Hit http://archive.ubuntu.com wily/universe Translation-en
Hit http://archive.ubuntu.com wily-updates/main Sources
Hit http://archive.ubuntu.com wily-updates/restricted Sources
Hit http://archive.ubuntu.com wily-updates/universe Sources
Hit http://archive.ubuntu.com wily-updates/multiverse Sources
Hit http://archive.ubuntu.com wily-updates/main amd64 Packages
Hit http://archive.ubuntu.com wily-updates/restricted amd64 Packages
Hit http://archive.ubuntu.com wily-updates/universe amd64 Packages
Hit http://archive.ubuntu.com wily-updates/multiverse amd64 Packages
Hit http://archive.ubuntu.com wily-updates/main i386 Packages
Hit http://archive.ubuntu.com wily-updates/restricted i386 Packages
Hit http://archive.ubuntu.com wily-updates/universe i386 Packages
Hit http://archive.ubuntu.com wily-updates/multiverse i386 Packages
Get:3 https://apt.dockerproject.org ubuntu-wily InRelease [454 B]
Ign https://apt.dockerproject.org ubuntu-wily InRelease
Hit http://archive.ubuntu.com wily-updates/main Translation-en
Hit https://apt.dockerproject.org ubuntu-wily Release.gpg
Hit http://archive.ubuntu.com wily-updates/multiverse Translation-en
Hit https://apt.dockerproject.org ubuntu-wily Release
Hit http://archive.ubuntu.com wily-updates/restricted Translation-en
Hit https://apt.dockerproject.org ubuntu-wily/main amd64 Packages
Hit https://apt.dockerproject.org ubuntu-wily/main i386 Packages
Hit http://archive.ubuntu.com wily-updates/universe Translation-en
Hit http://archive.ubuntu.com wily-backports/main Sources
Get:4 http://security.ubuntu.com wily-security/main Sources [28.3 kB]
Get:5 https://apt.dockerproject.org ubuntu-wily/main Translation-en_US [454 B]
Get:6 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
Hit http://archive.ubuntu.com wily-backports/restricted Sources
Hit http://archive.ubuntu.com wily-backports/universe Sources
Hit http://archive.ubuntu.com wily-backports/multiverse Sources
Hit http://archive.ubuntu.com wily-backports/main amd64 Packages
Hit http://archive.ubuntu.com wily-backports/restricted amd64 Packages
Get:7 http://security.ubuntu.com wily-security/restricted Sources [2,854 B]
Hit http://archive.ubuntu.com wily-backports/universe amd64 Packages
Hit http://archive.ubuntu.com wily-backports/multiverse amd64 Packages
Get:8 http://security.ubuntu.com wily-security/universe Sources [7,415 B]
Get:9 http://security.ubuntu.com wily-security/multiverse Sources [1,923 B]
Get:10 https://apt.dockerproject.org ubuntu-wily/main Translation-en_US [454 B]
Get:11 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
Get:12 https://apt.dockerproject.org ubuntu-wily/main Translation-en_US [454 B]
Hit http://archive.ubuntu.com wily-backports/main i386 Packages
Get:13 http://security.ubuntu.com wily-security/main amd64 Packages [90.0 kB]
Hit http://archive.ubuntu.com wily-backports/restricted i386 Packages
Get:14 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
Hit http://archive.ubuntu.com wily-backports/universe i386 Packages
Hit http://archive.ubuntu.com wily-backports/multiverse i386 Packages
Hit http://archive.ubuntu.com wily-backports/main Translation-en
Get:15 https://apt.dockerproject.org ubuntu-wily/main Translation-en_US [454 B]
Hit http://archive.ubuntu.com wily-backports/multiverse Translation-en
Hit http://archive.ubuntu.com wily-backports/restricted Translation-en
Hit http://archive.ubuntu.com wily-backports/universe Translation-en
Get:16 http://security.ubuntu.com wily-security/restricted amd64 Packages [10.9 kB]
Get:17 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
Get:18 https://apt.dockerproject.org ubuntu-wily/main Translation-en_US [454 B]
Ign https://apt.dockerproject.org ubuntu-wily/main Translation-en_US
Get:19 http://security.ubuntu.com wily-security/universe amd64 Packages [37.1 kB]
Get:20 https://apt.dockerproject.org ubuntu-wily/main Translation-en [454 B]
Ign https://apt.dockerproject.org ubuntu-wily/main Translation-en
Get:21 http://security.ubuntu.com wily-security/multiverse amd64 Packages [5,903 B]
Get:22 http://security.ubuntu.com wily-security/main i386 Packages [88.1 kB]
Get:23 http://security.ubuntu.com wily-security/restricted i386 Packages [10.8 kB]
Get:24 http://security.ubuntu.com wily-security/universe i386 Packages [37.1 kB]
Get:25 http://security.ubuntu.com wily-security/multiverse i386 Packages [6,076 B]
Hit http://security.ubuntu.com wily-security/main Translation-en
Hit http://security.ubuntu.com wily-security/multiverse Translation-en
Hit http://security.ubuntu.com wily-security/restricted Translation-en
Hit http://security.ubuntu.com wily-security/universe Translation-en
Fetched 455 kB in 3s (121 kB/s)
Reading package lists...

package: action=install name=curl
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y  curl
SSH cmd err, output: <nil>: Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version.
The following packages were automatically installed and are no longer required:
  linux-headers-4.2.0-16 linux-headers-4.2.0-16-generic linux-headers-4.2.0-18
  linux-headers-4.2.0-18-generic linux-headers-4.2.0-22
  linux-headers-4.2.0-22-generic linux-image-4.2.0-16-generic
  linux-image-4.2.0-18-generic linux-image-4.2.0-22-generic
  linux-image-extra-4.2.0-16-generic linux-image-extra-4.2.0-18-generic
  linux-image-extra-4.2.0-22-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 27 not upgraded.

Installing Docker...
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
if ! type docker; then curl -sSL https://get.docker.com | sh -; fi
SSH cmd err, output: <nil>: docker is /usr/bin/docker

waiting for docker daemon
checking docker daemon
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
sudo docker version
SSH cmd err, output: exit status 1: Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Error getting SSH command to check if the daemon is up: Something went wrong running an SSH command!
command : sudo docker version
err     : exit status 1
output  : Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

'sudo docker version' output:

checking docker daemon
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
sudo docker version
SSH cmd err, output: exit status 1: Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Error getting SSH command to check if the daemon is up: Something went wrong running an SSH command!
command : sudo docker version
err     : exit status 1
output  : Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

'sudo docker version' output:

checking docker daemon
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
sudo docker version
SSH cmd err, output: exit status 1: Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Error getting SSH command to check if the daemon is up: Something went wrong running an SSH command!
command : sudo docker version
err     : exit status 1
output  : Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

'sudo docker version' output:

checking docker daemon
(mymachine) Calling .GetSSHHostname
(mymachine) Calling .GetSSHPort
(mymachine) Calling .GetSSHKeyPath
(mymachine) Calling .GetSSHUsername
Using SSH client type: external
{[-o BatchMode=yes -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 root@mymachine.example.com -p 22] /usr/bin/ssh}
About to run SSH command:
sudo docker version
SSH cmd err, output: exit status 1: Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Error getting SSH command to check if the daemon is up: Something went wrong running an SSH command!
command : sudo docker version
err     : exit status 1
output  : Client:
 Version:      1.9.1
 API version:  1.21
 Go version:   go1.4.2
 Git commit:   a34a1d5
 Built:        Fri Nov 20 13:20:08 UTC 2015
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

I killed it here; otherwise it loops like that forever.

derFunk commented 7 years ago

Same is still happening to me today. Client:

$ docker-machine --version
docker-machine version 0.8.2, build e18a919

Server:

$ sudo docker version
Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:42:17 2016
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial

This is my log file:

Docker Machine Version:  0.8.2, build e18a919
Found binary path at /usr/local/bin/docker-machine
Launching plugin server for driver generic
Plugin server listening at address 127.0.0.1:41866
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(flag-lookup) Calling .GetMachineName
(flag-lookup) Calling .DriverName
(flag-lookup) Calling .GetCreateFlags
Found binary path at /usr/local/bin/docker-machine
Launching plugin server for driver generic
Plugin server listening at address 127.0.0.1:42910
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(mymachinename) Calling .GetMachineName
(mymachinename) Calling .DriverName
(mymachinename) Calling .GetCreateFlags
(mymachinename) Calling .SetConfigFromFlags
Running pre-create checks...
(mymachinename) Calling .PreCreateCheck
(mymachinename) Calling .GetConfigRaw
Creating machine...
(mymachinename) Calling .Create
(mymachinename) Importing SSH key...
(mymachinename) Calling .GetConfigRaw
(mymachinename) DBG | IP: server.ip.address
(mymachinename) Calling .DriverName
(mymachinename) Calling .DriverName
Waiting for machine to be running, this may take a few minutes...
(mymachinename) Calling .GetState
Detecting operating system of created instance...
Waiting for SSH to be available...
Getting to WaitForSSH function...
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
exit 0
SSH cmd err, output: <nil>: 
Detecting the provisioner...
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
cat /etc/os-release
SSH cmd err, output: <nil>: NAME="Ubuntu"
VERSION="16.04.1 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.1 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
UBUNTU_CODENAME=xenial

Couldn't set key UBUNTU_CODENAME, no corresponding struct field found
found compatible host: ubuntu
Provisioning with ubuntu(systemd)...
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
stat -f -c %T /var/lib
SSH cmd err, output: <nil>: ext2/ext3

No storagedriver specified, using aufs

setting hostname
(mymachinename) Calling .GetMachineName
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
sudo hostname mymachinename && echo "mymachinename" | sudo tee /etc/hostname
SSH cmd err, output: <nil>: mymachinename

(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:

        if ! grep -xq .*mymachinename /etc/hosts; then
            if grep -xq 127.0.1.1.* /etc/hosts; then 
                sudo sed -i 's/^127.0.1.1.*/127.0.1.1 mymachinename/g' /etc/hosts; 
            else 
                echo '127.0.1.1 mymachinename' | sudo tee -a /etc/hosts; 
            fi
        fi
SSH cmd err, output: <nil>: 
installing base packages
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
sudo apt-get update
SSH cmd err, output: <nil>: Hit:1 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:5 https://apt.dockerproject.org/repo ubuntu-xenial InRelease
Fetched 306 kB in 0s (920 kB/s)
Reading package lists...

package: action=install name=curl
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y  curl
SSH cmd err, output: <nil>: Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version (7.47.0-1ubuntu2.2).
The following packages were automatically installed and are no longer required:
  aufs-tools cgroupfs-mount
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.

Installing Docker...
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
if ! type docker; then curl -sSL https://get.docker.com | sh -; fi
SSH cmd err, output: <nil>: bash: line 0: type: docker: not found
apparmor is enabled in the kernel and apparmor utils were already installed
+ sudo -E sh -c apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D
Executing: /tmp/tmp.OvO4HG59b7/gpg.1.sh --keyserver
hkp://ha.pool.sks-keyservers.net:80
--recv-keys
58118E89F3A912897C070ADBF76221572C52609D
gpg: requesting key 2C52609D from hkp server ha.pool.sks-keyservers.net
gpg: key 2C52609D: "Docker Release Tool (releasedocker) <docker@docker.com>" not changed
gpg: Total number processed: 1
gpg:              unchanged: 1
+ break
+ sudo -E sh -c apt-key adv -k 58118E89F3A912897C070ADBF76221572C52609D >/dev/null
+ sudo -E sh -c mkdir -p /etc/apt/sources.list.d
+ dpkg --print-architecture
+ sudo -E sh -c echo deb \[arch=amd64\] https://apt.dockerproject.org/repo ubuntu-xenial main > /etc/apt/sources.list.d/docker.list
+ sudo -E sh -c sleep 3; apt-get update; apt-get install -y -q docker-engine
Hit:1 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu xenial InRelease
Get:2 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu xenial-updates InRelease [102 kB]
Get:3 http://eu-central-1.ec2.archive.ubuntu.com/ubuntu xenial-backports InRelease [102 kB]
Get:4 http://security.ubuntu.com/ubuntu xenial-security InRelease [102 kB]
Hit:5 https://apt.dockerproject.org/repo ubuntu-xenial InRelease
Fetched 306 kB in 0s (903 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
  docker-engine
0 upgraded, 1 newly installed, 0 to remove and 42 not upgraded.
Need to get 0 B/19.4 MB of archives.
After this operation, 102 MB of additional disk space will be used.
Selecting previously unselected package docker-engine.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 125225 files and directories currently installed.)
Preparing to unpack .../docker-engine_1.12.5-0~ubuntu-xenial_amd64.deb ...
Unpacking docker-engine (1.12.5-0~ubuntu-xenial) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu11) ...
Processing triggers for ureadahead (0.100.0-19) ...
Setting up docker-engine (1.12.5-0~ubuntu-xenial) ...
Processing triggers for systemd (229-4ubuntu11) ...
Processing triggers for ureadahead (0.100.0-19) ...
+ sudo -E sh -c docker version
Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:42:17 2016
 OS/Arch:      linux/amd64

If you would like to use Docker as a non-root user, you should now consider
adding your user to the "docker" group with something like:

  sudo usermod -aG docker ubuntu

Remember that you will have to log out and back in for this to take effect!

Cannot connect to the Docker daemon. Is the docker daemon running on this host?

waiting for docker daemon
checking docker daemon
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
sudo docker version
SSH cmd err, output: exit status 1: Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:42:17 2016
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Error getting SSH command to check if the daemon is up: Something went wrong running an SSH command!
command : sudo docker version
err     : exit status 1
output  : Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:42:17 2016
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

'sudo docker version' output:

checking docker daemon
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
sudo docker version
SSH cmd err, output: exit status 1: Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:42:17 2016
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Error getting SSH command to check if the daemon is up: Something went wrong running an SSH command!
command : sudo docker version
err     : exit status 1
output  : Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:42:17 2016
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

'sudo docker version' output:

checking docker daemon
(mymachinename) Calling .GetSSHHostname
(mymachinename) Calling .GetSSHPort
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHKeyPath
(mymachinename) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem (-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 ubuntu@server.ip.address -o IdentitiesOnly=yes -i /home/myusername/.docker/machine/machines/mymachinename/mycompany_staging.pem -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
sudo docker version
SSH cmd err, output: exit status 1: Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:42:17 2016
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

Error getting SSH command to check if the daemon is up: Something went wrong running an SSH command!
command : sudo docker version
err     : exit status 1
output  : Client:
 Version:      1.12.5
 API version:  1.24
 Go version:   go1.6.4
 Git commit:   7392c3b
 Built:        Fri Dec 16 02:42:17 2016
 OS/Arch:      linux/amd64
Cannot connect to the Docker daemon. Is the docker daemon running on this host?

...keeps looping the same output from 'sudo docker version' output: now...

What's wrong here - why is Docker not being started on the remote machine?

derFunk commented 7 years ago

I was able to fix my problem. It seems that my host had some old docker related data on it, for whatever reasons, which prevented it from starting/installing correctly.

I had to delete the existing /var/lib/docker and /etc/systemd/system/docker* files and folders. After that I had to issue a sudo systemctl daemon-reload. (Found also this: https://github.com/docker/docker/issues/15651#issuecomment-212992755)

The /var/lib/docker folder was primarily a problem because I ran into msg="Error starting daemon: error initializing graphdriver: \"/var/lib/docker\", reported by the docker service, checked via journalctl -xe.

After cleaning the host docker-machine was able to use it again.