安裝Pi可用的OS image
Hypriot為Raspberry Pi上面現成可用的Docker OS,透過下面方式可以安裝:
Download image
wget http://downloads.hypriot.com/hypriot-rpi-20151115-132854.img.zip
unzip hypriot-rpi-20151115-132854.img.zip
Copy into SD Card
dd bs=8m if=/path/to/hypriot-rpi-20151115-132854.img of=/dev/disk-to-your-sdcard
使用Pi內的docker
由於Pi的環境為ARM,一般的container在上面應該執行不起來,在這邊可以使用hypriot所提供的container來開始:
$ docker search hypriot
NAME DESCRIPTION STARS OFFICIAL AUTOMATED
hypriot/rpi-node RPi-compatible Docker Image with Node.js 39
hypriot/rpi-python RPi-compatible Docker Image with Python 16
hypriot/rpi-java RPi-compatible Docker Image with Java 16
hypriot/rpi-golang 14
hypriot/rpi-iojs RPi-compatible Docker Image with io.js 13
hypriot/rpi-gogs-raspbian Raspberry Pi compatible Docker Image with ... 8
hypriot/rpi-gpio Dockerized gpio binary of wiringPi for the... 8
hypriot/rpi-busybox-httpd Raspberry Pi compatible Docker Image with ... 7
hypriot/rpi-swarm Raspberry Pi compatible Docker image with ... 7
hypriot/rpi-mysql RPi-compatible Docker Image with Mysql 7
hypriot/rpi-hugo Raspberry Pi compatible Docker Image with ... 5
hypriot/rpi-alpine-scratch Raspberry Pi compatible Docker Image with ... 5
hypriot/rpi-redis Raspberry Pi compatible redis image 5
hypriot/rpi-ruby RPi-compatible Docker Image with Ruby 5
hypriot/rpi-haproxy Haproxy Dockerfile 4
hypriot/rpi-crate RPi-compatible Docker Image with Crate.io 3
hypriot/rpi-drone Raspberry Pi compatible Docker Image with ... 3
hypriot/rpi-dockerui An ARM compatible Docker image of https://... 3
np83/rpi2-hypriot-nodejs Raspberry PI 2 can run hypriot Docker host... 1 [OK]
hypriot/rpi-nano-httpd Raspberry Pi nano sized HTTP server 1
hypriot/rpi-registrator An ARM compatible Docker image of https://... 0
calou/hypriot-solr Solr on Raspberry Pi 0
calou/hypriot-zookeeper Zookeeper on Raspberry Pi 0
gdelpu/rpi-hypriot-node-hapi NodeJs with HapiJs framework 0
sergiohg/hypriot-rpi-consul 0
啟動Pi上的node.js環境
docker -it -p 3000:3000 hypriot/rpi-node bash
進去container之後,即可開始使用了唷~
進階安裝
在某些情況下,會需要安裝其他的套件來支援上面運行的程式,hypriot上可以透過apt-get來相關套件的安裝...
$ sudo apt-get install python2.7
安裝docker-compose
curl -L https://github.com/hypriot/compose/releases/download/1.2.0-raspbian/docker-compose-`uname -s`-`uname -m` > /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
安裝docker-machine (Mac端)
$ curl -o docker-machine http://downloads.hypriot.com/docker-machine_0.4.0-dev_darwin-amd64
$ chmod +x ./docker-machine
Reference
- Compose release for raspbian: https://github.com/hypriot/compose/releases
- Hypriot raspberry swarm cluster: http://blog.hypriot.com/post/let-docker-swarm-all-over-your-raspberry-pi-cluster/