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

Add support for Hypriot-OS on the Raspberry PI #3704

Open greylurk opened 8 years ago

greylurk commented 8 years ago

The folks over at http://blog.hypriot.com/ have built a custom raspbian-based distro which makes it easy to stand up a docker host on the Raspberry PI (and a few other ARM devices). However, when I try to add one of the new items to docker-machine, I get an "OS Type Unrecognized" error:

$ docker-machine -D create --driver generic --generic-ip-address=192.168.0.150 --generic-ssh-key=/Users/greylurk/.ssh/id_rsa --generic-ssh-user=pirate --engine-storage-driver=overlay docker-pi-1
Docker Machine Version:  0.8.0, build b85aac1
Found binary path at /usr/local/bin/docker-machine
Launching plugin server for driver generic
Plugin server listening at address 127.0.0.1:52931
() 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:52935
() Calling .GetVersion
Using API Version  1
() Calling .SetConfigRaw
() Calling .GetMachineName
(docker-pi-1) Calling .GetMachineName
(docker-pi-1) Calling .DriverName
(docker-pi-1) Calling .GetCreateFlags
(docker-pi-1) Calling .SetConfigFromFlags
Running pre-create checks...
(docker-pi-1) Calling .PreCreateCheck
(docker-pi-1) Calling .GetConfigRaw
Creating machine...
(docker-pi-1) Calling .Create
(docker-pi-1) Importing SSH key...
(docker-pi-1) DBG | IP: 192.168.0.150
(docker-pi-1) Calling .GetConfigRaw
(docker-pi-1) Calling .DriverName
(docker-pi-1) Calling .DriverName
Waiting for machine to be running, this may take a few minutes...
(docker-pi-1) Calling .GetState
Detecting operating system of created instance...
Waiting for SSH to be available...
Getting to WaitForSSH function...
(docker-pi-1) Calling .GetSSHHostname
(docker-pi-1) Calling .GetSSHPort
(docker-pi-1) Calling .GetSSHKeyPath
(docker-pi-1) Calling .GetSSHKeyPath
(docker-pi-1) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /Users/greylurk/.docker/machine/machines/docker-pi-1/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 pirate@192.168.0.150 -o IdentitiesOnly=yes -i /Users/greylurk/.docker/machine/machines/docker-pi-1/id_rsa -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
exit 0
SSH cmd err, output: <nil>:
Detecting the provisioner...
(docker-pi-1) Calling .GetSSHHostname
(docker-pi-1) Calling .GetSSHPort
(docker-pi-1) Calling .GetSSHKeyPath
(docker-pi-1) Calling .GetSSHKeyPath
(docker-pi-1) Calling .GetSSHUsername
Using SSH client type: external
Using SSH private key: /Users/greylurk/.docker/machine/machines/docker-pi-1/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 pirate@192.168.0.150 -o IdentitiesOnly=yes -i /Users/greylurk/.docker/machine/machines/docker-pi-1/id_rsa -p 22] /usr/bin/ssh <nil>}
About to run SSH command:
cat /etc/os-release
SSH cmd err, output: <nil>: PRETTY_NAME="Raspbian GNU/Linux 8 (jessie)"
NAME="Raspbian GNU/Linux"
VERSION_ID="8"
VERSION="8 (jessie)"
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
HYPRIOT_OS="HypriotOS/armhf"
HYPRIOT_OS_VERSION="v1.0.0"
HYPRIOT_DEVICE="Raspberry Pi"
HYPRIOT_IMAGE_VERSION="v1.0.0"

Couldn't set key HYPRIOT_OS, no corresponding struct field found
Couldn't set key HYPRIOT_OS_VERSION, no corresponding struct field found
Couldn't set key HYPRIOT_DEVICE, no corresponding struct field found
Couldn't set key HYPRIOT_IMAGE_VERSION, no corresponding struct field found
Error creating machine: Error detecting OS: OS type not recognized
notifying bugsnag: [Error creating machine: Error detecting OS: OS type not recognized]

If I edit the "ID=" field in /etc/os-release on the raspberry pi to read "ID=debian" instead of "ID=raspbian" then it works fine, so the fix might be to fall back to the ID_LIKE if the ID field isn't recognized, but I'm not sure how that affects other debian derivatives

bamarni commented 8 years ago

They also contributed a lot to integrate docker on raspbian directly, which is now available in the APT repo, so hypriot-os is not stricly required anymore :)

There is a PR on its way for a raspbian provisioner (#3605), looks good but it's blocked for now because of a small quirk related to systemd config.

helje5 commented 7 years ago

If I patch /etc/os-release, I get a little further with hypriotos-rpi-v1.4.0, but I still hit this subsequently:

$ docker-machine create --driver generic --generic-ip-address=192.168.88.72 --generic-ssh-user pirate zpi3
Running pre-create checks...
Creating machine...
(zpi3) No SSH key specified. Assuming an existing key at the default location.
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 debian...
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. See 'systemctl status docker.service' and 'journalctl -xn' for details.
rllola commented 6 years ago

up

tcurdt commented 5 years ago

Maybe this issue should be renamed to something more generic. The fact that ID_LIKE is not used as fallback is just clearly wrong.

Would be great to see this fixed.

agorgl commented 4 years ago

Just bumped to this too, would love to see the solution @tcurdt proposed implemented.

offbeatful commented 4 years ago

Still an issue in 2020.

aniongithub commented 4 years ago

If ID_LIKE=debian is specified, my one-liner PR should solve the issue. Hopefully it's merged and we can use docker-machine with debian-like distros.